homepage Welcome to WebmasterWorld Guest from 54.198.42.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Exclude Subdomain from root htaccess Rewrite
richrf




msg:4203437
 7:11 pm on Sep 17, 2010 (gmt 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]

 

Spiekerooger




msg:4203516
 11:49 pm on Sep 17, 2010 (gmt 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.

richrf




msg:4203709
 7:46 pm on Sep 18, 2010 (gmt 0)

Hi,

Thanks much. It worked.

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

Rich

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved