Forum Moderators: phranque

Message Too Old, No Replies

Confusing re-write

         

logic0

2:16 pm on Oct 15, 2007 (gmt 0)

10+ Year Member



here is the scenario.

I have two sites , we have a special configuration such that we have a 2 configuration files , one is common http.conf and server specific httpd.conf.

Each individual site uses common and server configuration and works fine.
www.test.xyz.com
www.kool.xyz.com

Whatever entry is made in common, its avaialable to all servers....

I am trying to use this centralized configuration for redirecting . Here is my logic . I am putting the below configuration file in common conf file .. so that when somebody says www.test.xyz.com , he should be redirected to www.test.xyz.com/test
and for www.kool.xyz.com , he should be redirected to www.kool.xyz.com/kool

RewriteEngine on
RewriteCond %{HTTP_HOST} www\.([^.]+)\.xyz\.com
RewriteRule ^/(.*)$ /%1/$1 [L]

For some reasons this is not working... let me know if i am missing something...

jdMorgan

3:15 pm on Oct 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What, specifically, isn't working? What were your test results, and how did they differ from your expectations?

Jim

logic0

3:20 pm on Oct 15, 2007 (gmt 0)

10+ Year Member



for some reasons this condition and rule is not getnn applied.

No output.. redirection is not working. Is condition and rule correct.

jdMorgan

3:24 pm on Oct 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is an internal rewrite, not a redirect. The code looks OK, though.

Did you restart your server after changing the code?
Did you flush your browser cache before testing the new code?
Do you have 'wild-card' subdomains defined in DNS and as ServerAliases?

Jim

g1smd

8:49 pm on Oct 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You mention redirect in the question, and then show code for a rewrite.

Which one do you really want?

logic0

12:33 pm on Oct 16, 2007 (gmt 0)

10+ Year Member



Please ignore earlier message. I found the issue because of this..

i had put the configuration under 443...Port 80 redirecting 443.

we have webserver running on ports 80 and 443..

thats

<VirtualHost *:80>
Redirect / [test.xyz.com...]
</VirtualHost>

RewriteEngine on
RewriteCond %{HTTP_HOST} www\.([^.]+)\.xyz\.com
RewriteRule ^/(.*)$ /%1/$1 [L]

For some reasons still above is not working... So

I tried with below, still not working

RewriteEngine on
RewriteCond %{HTTP_HOST} www\.([^.]+)\.xyz\.com
RewriteCond {SERVER_PORT} ^443$
RewriteRule ^/(.*)$ /%1/$1 [L]