Hi,
I am trying to write a .htaccess script that can redirect any URL on my site (whether it exists or not, including sub-domains) to the index page of that site.
For example:
example.com/pages/page.htm ---> example.com
sub.example.com/page.htm ---> example.com
error.example.com/error ---> example.com
I've tried a few things with mod_rewrite but I can't seem to get existing urls, non-existing urls and sub domain urls to all direct to the index page.
Thanks,
Martin
try this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule .* /index.php
try changing index.php to index.html, or whatever the index file is you want to see. i think that will work, though I havnt tested it.
kylegetson
Junior Poster in Training
89 posts since Sep 2009
Reputation Points: 26
Solved Threads: 12