.htaccess - 301 redirects to all except robots.txt -


we have moved our website new domain , want pages of old site removed search engines. it's same site, same content, new domain, search engines taking time because of duplicate content (maybe). have added .htaccess 301 our old site new site as:

redirect 301 / http://new-domain.com/ 

now, remove our old site search engines, changed our robots.txt on old site as:

user-agent: * disallow: / 

the problem is, search engines fetching robots.txt new-domain.com because of .htaccess 301 redirect.

how restrict 301 redirect robots.txt?

remove redirect directive , try mod_rewrite rule:

rewriteengine on rewriterule !^robots\.txt$ http://other.example.com%{request_uri} [l,r=301] 

this redirect request except /robots.txt.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -