Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect Problem:

301 redirect problem, htaccess problem, redirect one web page to another

         

downtownpets

3:40 pm on Aug 18, 2010 (gmt 0)

10+ Year Member



Hi,

I'm assuming the answer to my question is pretty simple but I can't seem to get a 301 redirect to work.

The following is the code I have in my .htaccess file:

>>>>>>>>>>

ErrorDocument 404 [downtownpet.com...]

"RewriteEngine on":

Redirect 301 /old.html [downtownpet.com...]

>>>>>>>>>>>

Any feedback would be appreciated or a point in the right direction, thanks!

downtownpets

3:42 pm on Aug 18, 2010 (gmt 0)

10+ Year Member



Sorry, didn't mean to post links so I'll edit:


The following is the code I have in my .htaccess file:

>>>>>>>>>>

ErrorDocument 404 example-site.com/404-error.html

"RewriteEngine on":

Redirect 301 /old.html example-site.com/example-folder/example-page.html/example-site.com/example-page.html

>>>>>>>>>>>

Any feedback would be appreciated or a point in the right direction, thanks!

jdMorgan

4:45 am on Aug 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You've said what your code looks like, and said that there is a problem, but have not stated specifically what the problem is, or how you tested this code. That makes guessing the possible cause rather difficult...

Nevertheless, there is indeed a very serious problem here -- one that can destroy your search rankings quite quickly and thoroughly. So fixing that as well as proposing a possible fix for your redirect, replace everything you posted above with:

ErrorDocument 404 /404-error.html
#
RedirectMatch 301 ^/old\.html$ http://example.com/nyc_dog_trainer/

Note that the path to the 404 error document *must* be a local filepath and not a URL. If you use a URL, then all requests for non-existent objects on your site will be served a 302-Found redirect response. This can have very bad effects on search engines' willingness to spider your site -- They know that they will get a page for *any* URL that they request from your domain... Not good. See Apache core ErrorDocument directive documentation for details.

I opted to use RedirectMatch instead of the Redirect directive, because it can be used to specify one and only one specific URL-path to be redirected. This is unlike the Redirect directive, which uses prefix-matching and therefore redirects any requested URL-path that *starts with the path you specify. See Apache mod_alias documentation for details.

Jim

downtownpets

5:32 pm on Aug 26, 2010 (gmt 0)

10+ Year Member



Thanks a lot Jim, will try this shortly and will try and be more informative in questions, thx

downtownpets

9:39 pm on Aug 26, 2010 (gmt 0)

10+ Year Member



Hi Jim, if any damage was done by the very short period I had the incorrect code is there anything I can do to try and reverse what was done? thank you.

jdMorgan

12:22 pm on Aug 27, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nothing for it but to wait until the SEs pick up the effects of the corrected server configuration.

Jim