Forum Moderators: phranque
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^forum\.example\.com
RewriteRule (.*) http://forum.example.net/$1 [R=301,L]
Do you know what I am doing wrong, btw I have other rewrite rules placed after that rule like redirecting non www to www and works fine.
[edited by: jdMorgan at 2:10 am (utc) on Dec. 3, 2007]
[edit reason] example.com [/edit]
First, be sure that the code is in an .htaccess file that will be executed as the server traverses the filepath to reach the directory where the forum files are located. That is, if forum.example.com files are located in a separate directory which is not "below" the directory containing this rule, then this rule won't apply to requests for that subdomain.
Second, be sure to completely flush your browser cache before testing after uploading any changed configuration code to your server.
Jim
The main difference between mod_rewrite code in .htaccess and in http.conf is that the URL-pattern in RewriteRule should include a leading slash in httpd.conf, but not in .htaccess.
Jim