Welcome to WebmasterWorld Guest from 54.145.53.251

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Exclude Subdomain from root htaccess Rewrite

     
7:11 pm on Sep 17, 2010 (gmt 0)

New User

5+ Year Member

joined:Apr 6, 2006
posts: 21
votes: 0


Hi,

I am running a script in my root that has the following htaccess code. It is interfering with Wordpress which is running in a subdomain on the same server. How can I limit this htaccess code so that it does not interfere with the operation of Wordpress. I did not write the code. It comes with the script. Thanks for the help!

Rich

RewriteRule \.(css|php|png|jpg|gif|ico|js|inc|txt|gz|xml|html)$ - [NC,L]
RewriteRule ^([^/]*)/?$ index.php?page=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/?$ index.php?$1=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$ index.php?page=$1&$2=$3 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?$1=$2&$3=$4 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?page=$1&$2=$3&$4=$5 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?$1=$2&$3=$4&$5=$6 [L]
11:49 pm on Sept 17, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:June 12, 2005
posts:45
votes: 0


Are the subdomain and domain pointing to the same physical directory on your server?

Anyway, without knowing your server and sub-/domain configs, you could prevent any interferences by putting this line before each RewriteRule:

RewriteCond %{HTTP_HOST} !^sub\.example\.com$

which tells apaches mod_rewrite module not to follow the following rule if the domain host is your subdomain.
7:46 pm on Sept 18, 2010 (gmt 0)

New User

5+ Year Member

joined:Apr 6, 2006
posts: 21
votes: 0


Hi,

Thanks much. It worked.

Yes, the domain and subdomain are on the same server hosted on Hostgator.

Rich