Forum Moderators: phranque

Message Too Old, No Replies

Exclude subdomain

         

Karma

10:01 am on May 11, 2006 (gmt 0)

10+ Year Member



Hi,

I’ve just purchased some hosting for a site of mine and I’ve just moved everything across but now I’m having problems getting the subdomain working.

The main site works fine (ht tp://www.example.com) and this relates to folder “public_html/”, which is where I have placed my .htaccess rewrite. However, my subdomain (ht tp://forums.example.com) relates to “public_html/forums/” which don’t function properly as it's affected by the .htaccess file (If I remove the .htaccess the forums work fine).

The .htaccess file from public_html root is as follows:
------------------------------------------
RewriteEngine on
RewriteRule ^([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/?$ /index.php?$1=$2&$3=$4&$5=$6 [L]
RewriteRule ^([^_]+)_([^/]+)/([^_]+)_([^/]+)/?$ /index.php?$1=$2&$3=$4 [L]
RewriteRule ^([^_]+)_([^/]+)/?$ /index.php?$1=$2 [L]
RewriteRule ^index\.html$ /index.php [L]
------------------------------------------

Could someone please tell me how I can exclude the forums subdomain?

ahmedtheking

11:49 am on May 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i think you need this: Options -FollowSymLinks

Check this post out: [webmasterworld.com...]

jdMorgan

12:33 pm on May 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not clear how forums.example.com gets mapped to your subdirectory, but generally, you can either add an exclusion to each rule like:

RewriteCond %{HTTP_HOST} !^forums\.

Or, if you have no other rules that must be processed for requests to the forums, you can add a new rule ahead of the four you already have that just exits when they are requested:

RewriteRule %{HTTP_HOST} ^forums\.
RewriteRule .* - [L]

However, if there are further rules that may apply to forum requests, then you can tell mod_rewrite to skip the next 4 rules with:

RewriteRule %{HTTP_HOST} ^forums\.
RewriteRule .* - [S=4]

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim