Forum Moderators: phranque
sorry if this has been answered before but i couldn't find it on the forum,
I am trying to redirect
[somewhere.com...] to [somewhere.com...]
RewriteEngine on
RewriteRule ^/$ /index.php?cat=1 [R]
didn;t work and neither did
RedirectMatch ^/$ [somewhere.com...]
any suggestions
Cheers
Welcome to WebmasterWorld!
> RedirectMatch ^/$ http://www.example.com/index.php?cat=1
You didn't say where you were putting your code, but the directive above should have worked in either httpd.conf or in .htaccess. If it's not working, investigate your settings for AllowOverride and Options. These need to be set up to give you "permission" to do redirects.
If you don't have access to the server config, then contact your hosting service and ask them why the above directive does not work.
I don't want to distract from the subject of this thread until you get the main problem resolved. But I cannot recommend doing an external redirect from "/" to /index.php?anything. You will have better search engine ranking results and a faster-responding and more professional-looking site if you do an internal rewrite instead. In this way, requests for "/" cause the server to serve index.php?cat=1, but the visitor's address bar never changes -- It still shows "yourdomain.com/". The visitor also does not have to wait while his browser re-fetches the content from the new URL. Once you get the main problem resolved, look into using an internal rewrite, or defining your index.php as the default index file to avoid doing any redirecting or rewriting at all (See Apache DirectoryIndex directive).
Jim