I have the following rule which redirects the page “example2.test.com” to “www.example2.test.com/index.shtml” — i.e. it appends index.shtml to it
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example2.test.com$
RewriteRule (.*) http://www.example2.test.com/index.shtml [R,L]
If I change the rule to try and catch if a user enters in www.example2.test.com as per below I get an error telling me there are too many redirects
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example2.test.com$
RewriteRule (.*) http://www.example2.test.com/index.shtml [R,L]
Is there something I am mising here ?? – im a bit new to this ..
Thanks…
RewriteCondis basically an if statement, and by default the server will try to access the index page, so what your second example says isYou’re creating an infinite loop, because once it gets redirected it gets reevaluated, which redirects it.
If you’re not getting that
index.shtmlpage when you visit that url you might need to addindex.shtmlto your apache directory index. so open yourhttpd.confand find where it says something likeand add
index.shtmlto it if it isn’t already there so you end up with