homepage Welcome to WebmasterWorld Guest from 54.161.147.106
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

    
mod_rewrite exception. Need a little help here.
mod_rewrite subdomain
hp_solomon




msg:1509517
 4:24 pm on May 22, 2006 (gmt 0)

I created a script rewrite URL that creates fake subdomains from a query string parameter. For example:

[domain.com...] to [bandname.domain.com...]

The mod_rewrite script also exclude or prevent the [webmail.domain.com...] from being rewriten. Here is the script:

ServerAlias *.domain.com
RewriteEngine on
# RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI}!^/viewforum\.php$
RewriteCond %{HTTP_HOST}!^(www¦webmail)\.domain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com
RewriteRule . /viewforum.php?f=%1 [L]

The script worked perfectly, but now I have a problem. I created another subdomain for my site (http://blogs.domain.com) but I dont know how to exclude it from the mod_rewrite script. I tried to modify it but it doesn't work. Here is the modified script

RewriteEngine on
#RewriteMap lowercase int:tolower
ServerAlias *.domain.com
RewriteCond %{REQUEST_URI}!^/viewband.php$
RewriteCond %{HTTP_HOST}!^(www¦webmail).domain.com
RewriteCond %{HTTP_HOST}!^(www¦blogs).domain.com ---> i added this script to exclude blogs.domain.com
RewriteCond %{HTTP_HOST} ^([^.]+).domain.com
RewriteRule . /viewforum.php?f=%1 [L]

It doesn't work as I expected. I can't access the subdomain site and when i browse it, it goes to the [domain.com...] homepage.

Please advise what to do. Please help.

Thank you very much

 

jdMorgan




msg:1509518
 6:53 pm on May 22, 2006 (gmt 0)


RewriteEngine on
RewriteCond %{REQUEST_URI} !^/viewforum\.php$
RewriteCond %{HTTP_HOST} !^(www¦webmail¦blogs)\.domain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com
RewriteRule . /viewforum.php?f=%1 [L]

Replace all broken pipe "¦" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.

Jim

hp_solomon




msg:1509519
 4:04 am on May 23, 2006 (gmt 0)

Thank you very much Jim.

Should I also remove or retain this line?

ServerAlias *.domain.com

Thanks for the help.

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