.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

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -