You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Z-man <dz...@theramp.net> on 2000/09/03 19:30:39 UTC

New to Apache and need help!

Hi All
Can Anyone here help me out?I'm trying to use the rewrite mod and have
run into a problem.I've added the rewritecond and rules into my config
file and it works if I use www in my url but will not work without
it.I'd rather it worked the opposite way but will settle for both if
that's the best I can do.The conditions I added are as follows:

>                         Rewritelog logs/rewrite.log
>                     RewritelogLevel 9
>
>
>                     RewriteMap       lowercase       int:tolower
>                     RewriteEngine on
>
>                     RewriteCond       ${lowercase:%{HTTP_HOST}}       !^$
>                     RewriteCond       ${lowercase:%{HTTP_HOST}}       !^www\.myserver.com$
>
>
>                     RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.)([^.]+)\.myserver\.com$
>                     RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1       [C]
>                     RewriteRule       ^(www\.)([^.]+)\.myserver\.com(.*)       /users/$2$3       [L]
>
>                     RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.)[^.]+\.[^.]+\.myserver\.com$
>                     RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1       [C]
>                     RewriteRule       ^(www\.)([^.]+)\.([^.]+)\.myserver\.com(.*)       /users/$3/$2$4       [L]
>
Do I need to change anything here or am I missing something?Also If it
makes a difference I'm running apache on win2k.
Thanks for any and all help...
Denis

Re: New to Apache and need help!

Posted by Z-man <dz...@theramp.net>.
Thanks , That did the trick!
Denis

Jonathan Leto wrote:

>  Z-man (dzapped@theramp.net) was saying:
>
> >
> >    Hi All
> >    Can Anyone here help me out?I'm trying to use the rewrite mod and have
> >    run into a problem.I've added the rewritecond and rules into my config
> >    file and it works if I use www in my url but will not work without
> >    it.I'd rather it worked the opposite way but will settle for both if
> >    that's the best I can do.The conditions I added are as follows:
> >
>
> Try this, notice the question marks after the (www\.), which shows that
> it is optional.
>
> Rewritelog logs/rewrite.log
> RewritelogLevel 9
>
> RewriteMap       lowercase       int:tolower
> RewriteEngine on
>
> RewriteCond       ${lowercase:%{HTTP_HOST}}       !^$
> RewriteCond       ${lowercase:%{HTTP_HOST}}       !^www\.myserver.com$
>
>
> RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.)?([^.]+)\.myserver\.com$
> RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1 [C]
> RewriteRule       ^(www\.)?([^.]+)\.myserver\.com(.*) /users/$2$3       [L]
>
> RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.)[^.]+\.[^.]+\.myserver\.com$
> RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1 [C]
> RewriteRule       ^(www\.)?([^.]+)\.([^.]+)\.myserver\.com(.*)       /users/$3/$2$4       [L]
> >
> >    Do I need to change anything here or am I missing something?Also If it
> >    makes a difference I'm running apache on win2k.
> >    Thanks for any and all help...
> >    Denis
>
> --
> jonathan@leto.net
> "With pain comes clarity."


Re: New to Apache and need help!

Posted by Jonathan Leto <jo...@leto.net>.
 Z-man (dzapped@theramp.net) was saying:

> 
>    Hi All
>    Can Anyone here help me out?I'm trying to use the rewrite mod and have
>    run into a problem.I've added the rewritecond and rules into my config
>    file and it works if I use www in my url but will not work without
>    it.I'd rather it worked the opposite way but will settle for both if
>    that's the best I can do.The conditions I added are as follows:
>    

Try this, notice the question marks after the (www\.), which shows that
it is optional.

Rewritelog logs/rewrite.log
RewritelogLevel 9

RewriteMap       lowercase       int:tolower
RewriteEngine on
 
RewriteCond       ${lowercase:%{HTTP_HOST}}       !^$
RewriteCond       ${lowercase:%{HTTP_HOST}}       !^www\.myserver.com$
 
 
RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.)?([^.]+)\.myserver\.com$
RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1 [C]
RewriteRule       ^(www\.)?([^.]+)\.myserver\.com(.*) /users/$2$3       [L]
 
RewriteCond       ${lowercase:%{HTTP_HOST}}       ^(www\.)[^.]+\.[^.]+\.myserver\.com$
RewriteRule       ^(.+)       ${lowercase:%{HTTP_HOST}}$1 [C]
RewriteRule       ^(www\.)?([^.]+)\.([^.]+)\.myserver\.com(.*)       /users/$3/$2$4       [L]
> 
>    Do I need to change anything here or am I missing something?Also If it
>    makes a difference I'm running apache on win2k.
>    Thanks for any and all help...
>    Denis

-- 
jonathan@leto.net 
"With pain comes clarity."