LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Redirecting using Apache and .htaccess (https://www.linuxquestions.org/questions/linux-general-1/redirecting-using-apache-and-htaccess-740584/)

Echo Kilo 07-16-2009 01:28 PM

Redirecting using Apache and .htaccess
 
Hello:

I am trying to redirect from the page: thesolarforum.com/forum

to the new forum at thesolarforum.com/mm-forum

But, I can't seem to figure out what's wrong with my code in the .htaccess file

RewriteCond %{HTTP_HOST} ^thesolarforum.com\forum$ [OR]
RewriteCond %{HTTP_HOST} ^www.thesolarforum.com\forum$
RewriteRule ^$ "http\:\/\/www\.thesolarforum\.com\/mm-forum/listcat\/" [R=301,L]

Oh, I'm a novice so please consider that with suggestions. ;)

bathory 07-16-2009 02:22 PM

First you need a
Code:

RewriteEngine on
unless you already have it in httpd.conf.
Then in the RewriteCond you should use REQUEST_URI instead of HTTP_HOST, and also the backslashes are wrong:
Then you need a "^(.*)" (means everything) in the RewriteRule. Also there is no need to escape every special character.
So try the following and see if it works:
Code:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/forum
RewriteRule ^(.*) http://www.thesolarforum.com/mm-forum/listcat [R=301,L]


Echo Kilo 07-16-2009 02:27 PM

Thank you - that worked like a charm!!!


All times are GMT -5. The time now is 02:30 AM.