Forum Moderators: phranque

Message Too Old, No Replies

Redirect all urls except /robots.txt file using htaccess

htaccess redirection

         

hoogman

7:41 pm on Apr 26, 2006 (gmt 0)

10+ Year Member



I am trying to redirect all traffic to a new domain except for the robots.txt file.

jdMorgan

6:15 pm on Apr 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hoogman,

Welcome to WebmasterWorld!

This is a fairly simple exercise using Apache mod_rewrite. Since you don't appear to have a specific question, the documents cited in our Forum Charter [webmasterworld.com] will probably help you get going.

Jim

hoogman

6:34 pm on Apr 28, 2006 (gmt 0)

10+ Year Member



Thanks, I ended up having the answer to my question already. The problem ended up being a missing file that was not moved when the directory was changed. Here is the access code I used incase anyone else runs into the same problem.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/robots\.txt [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]

[edited by: jdMorgan at 3:06 am (utc) on April 29, 2006]
[edit reason] Formatting [/edit]