homepage Welcome to WebmasterWorld Guest from 54.167.174.90
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Site Move - Checking Rewrites for Proper Status Code
Jessica97

10+ Year Member



 
Msg#: 3709355 posted 4:14 pm on Jul 28, 2008 (gmt 0)

Hello, I'm looking for some feedback as to how to check that a rewrite that a consultant proposes is in the correct format. I'm not sure that it is, although I specified that I need a 301 status code returned so that page rank is transferred to the new url when we actually move the site.

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.

 

JamieBrown

5+ Year Member



 
Msg#: 3709355 posted 4:22 pm on Jul 28, 2008 (gmt 0)

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.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3709355 posted 6:42 pm on Jul 28, 2008 (gmt 0)

You could do a rewrite (that's a rewrite, not a redirect) to the script. The rewrite will NOT expose the folder and filepath where the script resides.

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.

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3709355 posted 6:58 pm on Jul 28, 2008 (gmt 0)

It would be a mistake to allow a 301 redirect to 'expose' the php back-end of your site. The most likely cause of this is that the rules proposed by your consultant are in the wrong order.

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved