Forum Moderators: phranque
Here is an overview of the situation.
Consultant wrote script to capture the itemid in the old existing url string and says he was doing a 301 redirect and the header response would be ok. (Rather than just assuming that it was ok, I ran some of his work thru a checker) I have a sample of one of his proposed new links and when I check it using a server header checker I do get a 301 status along with a 200 status.
The 301 status that I get however, shows the redirect target to be his catch.php? page and
then a 2nd server response shows a 200 ok, with again the catch.php page listed but it is not showing the newly written clean url which does not have any query strings.
My question to you all here is: Am I correct in thinking that this type of redirect will do nothing for the site, and that I need to ask the consultant to return a clean 301 whereby the response header will show the new clean url and not the intermediary page?
There are too many urls to handwrite individually in .htaccess so he came up with the solution of using a script to take the id from the string and then do a 301 redirect.
1. Is there a way of using an intermediary page that will return the proper 301 result?
or
2. Is it absolutely necessary to use .htaccess in some manner to do the wildcard redirections and/or what do you all recommend when there are thousands of urls' that need redirected via 301?
Any suggestions or ideas or welcome. I just first wanted some input to see if I was on the right track with picking up in advance of the move that this was not the correct way to do the 301's. Next step is I have to come up with a solution to remedy the situation or find a new approach to doing the 301 rewrites altogether.
As always your input is appreciated.
My question to you all here is: Am I correct in thinking that this type of redirect will do nothing for the site, and that I need to ask the consultant to return a clean 301 whereby the response header will show the new clean url and not the intermediary page?
Yes - you're absolutely correct. Anything else will water-down the effectiveness of the redirects. The script needs to 301 directly to the nearest equivalent page on the new site.
1. Is there a way of using an intermediary page that will return the proper 301 result?
Again, yes, absolutely. Assuming your site is PHP based, do a search on Google for "301 redirect in php" and there's loads of tutorials. Its fairly easy really, as long as you are familiar with PHP. You should just need one script on your old domain that picks up all incoming queries, and translates them to the new URL.
I think your developer may need a bit of a kick! Unless there are specific complications around your site that I'm not clear on.
The script could then issue an external 301 redirect to the new URL.
That would work, producing a direct 301 response without any other intermediate URLs being shown.
External redirects go first, in order from most-specific pattern to least-specific pattern.
Internal rewrites follow, again in most-specific to least-specific order.
Where two or more rules of equal specificity are mutually-exclusive, their order does not matter.
So for example, you might redirect a single page with a specific query string first, followed by a redirect for a specific page, followed by a redirect for a group of pages in a specific directory, followed by a redirect for an entire directory, followed by a "catch-all" redirect for pages named ".htm" instead of the proper-on-your-site "html," and finally ending up with a domain canonicalization redirect.
These external redirect rules would then be followed by your internal rewrites --rewriting static-looking URLs to your script, for example-- and again following the most-specific-first method outlined above.
Be sure to test combinations of URL "errors" as well. That is, request an old (redirected) URL from the non-canonical domain, and make sure it gets redirected to the new URL in the canonical domain in one single 301-redirect.
Jim