Forum Moderators: phranque

Message Too Old, No Replies

error doc picking up the rewrite

how to write rewrite for files in folders?

         

Lorel

8:09 pm on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm trying to set up a rewrite for a spelling error in a file that was indexed (it's now showing up as supplemental in Google) and the file is in a folder so I'm not sure I have the rewrite correct as the error doc is picking it up instead of redirecting it.

ErrorDocument 400 /e400.html

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

RewriteRule ^\/folder\/4ft-thigie\.htm$ /folder/4ft-thingie-whatchmacallit.htm [R=301,L]

Can someone tell me if there is an error in the above?

ChadSEO

8:40 pm on Aug 8, 2006 (gmt 0)

10+ Year Member



Lorel,

For one, you don't need to escape the slashes. Also, is this in the httpd.conf file, or in an .htaccess file? If it's in an .htaccess file, then try the following:

RewriteRule ^folder/4ft-thigie\.htm$ /folder/4ft-thingie-whatchmacallit.htm [R=301,L]

If it is in the httpd.conf file, then try this (note the preceeding slash):

RewriteRule ^/folder/4ft-thigie\.htm$ /folder/4ft-thingie-whatchmacallit.htm [R=301,L]

Hope that helps!

Chad

Lorel

6:04 pm on Aug 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks Chad,

I thought I had to escape slashes.

It's working now.

g1smd

8:11 pm on Aug 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If someone requests the incorrect spelling on the non-www site, then there is a double redirect to get to the correct URL.

I would have the correct domain as part of the target of that spelling-correction redirect, and would place that redirect as the first instruction in the .htaccess file.