Here is my code for .htaccess
RewriteEngine on
RewriteRule (.*) index.html
Problem : when visit mydomain.com/robots.txt then page again redirect to index.html
Required :
if(url contain robots.txt) Then
redirect to mydomain.com/robots.txt
else
redirect to index.html
Try this:
Basically, those two
RewriteCondtell apache to rewrite the URL only if the requested file (-f) or directory (-d) doesn’t exists (the!serves as a negation).Alternatively, if you need it just for
robots.txtyou can use something like:instead of the two
RewriteCondabove.