Forum Moderators: phranque
I wonder if you could help.
I am trying to set up an htaccess instruction that will basically send all urls for a site to the index.html page of the same site.
For example, if I enter [site.com...] it will just go to [site.com...]
and the same for any possible url whether it it actually exists on the sever or not.
The reason for this is that I have an old site that basically nw just consists of the index.html page all the other stuff has been cleared out - but there are many links etc to specific pages on the site that I would like just directed to the index page. I've tried a few things but non seem to work.
Should work.
Order Deny,Allow
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}!index\.html
RewriteRule (.*) [mysite.com...] [R=301,L]
I get internal server error for any url to that site
Welcome to WebmasterWorld [webmasterworld.com]!
You'll need to add a required space preceding the "!" in the RewriteCond. Posting on this board invokes a filter that removes "extra" spaces, and our code falls victim to it. The work-around is to type two spaces.
Also, you won't need the "Order" directive, unless you have subsquent "Allow from" and/or "Deny from" directives.
I've occasionally used something like this:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index\.html$
RewriteRule (.*)\.html$ http://www.mysite.com/index.html [R=301,L]
Jim
[edited by: jdMorgan at 2:44 pm (utc) on May 14, 2004]
Also, see this thread [webmasterworld.com] for a related issue.
Jim