Is it possible to create dynamic 301 redirect urls ?
I have a dating site and the url format is like /dating/united_states_singles/. A few months ago, I changed it to /free-dating/united_states/ (added free and removed singles). When I checked on Google webmaster tool, both URLs (old and new) are indexed, which create duplicate title and description tags.
Is it possible to create 301 redirect for all old urls to new urls format?
If this is a windows IIS server url the url rewrite module
http://www.iis.net/downloads/microsoft/url-rewrite
Related
I am currently redirecting a website to another new website. My question is does a redirect automatically move my metadata (titles, taglines, meta description, focus keyphrases) to the new site? or Do I have to manually copy and paste metadata to the new site?
Better put - do my rankings from the old site as a result of metadata automatically point to my new site upon redirecting?
Thanks.
You are going to want to look into using a specific kind of redirect, which is the HTTP 301 redirect. That status code means its a permanent redirect, and most search engines will recognize that and will help keep your SEO.
If you do a HTTP 302 redirect, this being known as a temporary redirect, will technically be considered a new URL in the eyes of a search engine.
So when you are testing you redirect, make sure you open up Chrome Dev Tools (F12) and click the network tab. Refresh the page and click the first row that appears in the table. It should specify the HTTP status code, most likely being 200 (status ok), (301/302) permanent/temporary redirect, (404) file not found, 500 (server error).
So essentially, make sure your redirect is using a 301 redirect, if it is permanent of course!
Both domains were purchased through network solutions. The old host won't exist anymore, so I can't rely on them to serve the htaccess redirects. I can point the nameservers to the new host, but then what? None of my redirect code seems to be working. Any help is much appreciated.
Ex:
olddomain.com > newdomain.com
olddomain.com/hello > newdomain.com/goodbye
olddomain.com/123 > newdomain.com/456
You probably want to do something similar to this: .htaccess RewriteRule: two domains using same server and directory
Having that said, in most cases a static html page saying "This page has moved. Link to new page: ..." is preferred above .htaccess redirects, because people browsing your webpage will then update their bookmarks to the new URL, which they will not otherwise.
Moved content from php files to content management system. Changed page extensions from .php to without any extension, like: before some-page.php after some-page
All php pages keep at server, but made redirection in each php file, like header('Location:'. basename($_SERVER['PHP_SELF'],'.php') );. I cannot (do not know how to) do it in .htaccess, because in .htaccess is this code
RewriteRule ^([a-zA-Z0-9_-]+)$ show-content.php?$1
DirectoryIndex show-content.php?index
From google webmasters tools removed previous sitemap and added the new sitemap. See that the new sitemap accepted, but no urls included.
All above I did 3-4 days before. And today see that website dropped down in search results (some pages can not find at all in first pages).
Trying to understand what I did wrong.
Seems the first thing is wrong redirection code. Changed to header('Location:'. basename($_SERVER['PHP_SELF'],'.php'), true, 301 );. Is such code ok?
What else I did wrong?
You definitely need to do a 301 redirect from the old URL (with the extension) to the new URL (without the extension) as this tells Google the page has moved to a new location and you want all links and other SEO goodness (like rankings) need to be "transferred" to the new URL.
You can do the 301 redirect any way you want so using PHP's header() is fine as long as you are redirecting to the right page. Your example should work fine.
Is there any way to identify the url which redirected to another one?
To be clear, let's say we have example-domain.com which redirects (302) to exampledomain.com.
I thought that maybe the http_referer server variable would contain the redirecting url but thats not the case. Is that possible at all?
Wouldn't let me comment or upvote as I'm too new. Wondering if you're still having this problem - as I am too.
If you have control over both domain names, I would suggest you 302 to the URL exampledomain.com?refUrl=example-domain.com and pull the data from the querystring.
If you DON'T have control over both domain names, you are in same situation as me and my non-intentional duplicate question (3rd party is 302 redirect to my website, how to stop?)
In my case from testing, the http_referrer returns the site 'before' the site doing the 302. IE "Google (Click) Example-Domain (302) ExampleDomain"... the http referrer returns Google.
We've just put a new website live and I have varying Url re-writing in place to handle the old indexed pages, performing a 301 redirect to the new equivalent page location on the new site.
We've noticed since the day the new site went live that in Google Analytics, the stats in general have plummeted substantially :(
One of our SEO guys has pointed out that when you click on one of the old indexed pages in google, it correctly 301's to the new location, however, if you view the __utmz Google Analytics cookie, it has 'direct' in it, whereas he believes that should be 'organic'.
He thinks that the referrer information is being lost during the 301 redirect, and as a result, this is being treated as direct traffic instead of organic?
The new website is an ASP.NET 4.0 Web Forms application and is using Routing for the new Url's. I am generating the new route/url for old pages within the global.asax within the Application_BeginRequest routine.
If a 301 is needed for the request, this is the code that is executed:
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", newUrl);
Response.End();
Is there anything here that would indicate what the problem might be, or any ideas beyond the above what might be causing such an issue?
I located the problem - a silly error on my part with a relative url to a file that accompanies our google analytics tag, working in some locations of the website, but in others, the include was returning a 404! My bad.