Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite

one particular address fails

         

mokuril

8:49 am on Sep 15, 2005 (gmt 0)

10+ Year Member



I have a weird mod rewrite problem.
I have three urls which i would like to pass to 1 address.

example.com
user.provider.org
web.provider.org/~user

all have to end up on (query strings must be taken along):

http://www.example.com/

With the first two I haven't got a single problem doing:

RewriteCond %{HTTP_HOST} ^example\.com回user\.provider\.org回web\.provider\.org
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

It's with the third that something odd happens. When I enter 'web.provider.org/~user' in my address bar, it switches to www.example.com//home/user/www. If I enter any other address (eg. http://web.provider.org/~user/), it works fine... So when a '/' follows ~user, there is no problem at all.

I tried rewriting the RewriteCond like this:

RewriteCond %{HTTP_HOST} ^example\.be回user\.provider\.org回web\.provider\.org/~user

but then it fails on all addresses based upon web.provider.org/~user.

I've been searching and searching...
Many thanks in advance!

[edited by: jdMorgan at 2:20 pm (utc) on Sep. 15, 2005]
[edit reason] Example.com [/edit]

dcrombie

10:35 am on Sep 15, 2005 (gmt 0)



I imagine the problem is that /~user isn't included in %{HTTP_HOST}. You might have to check agains %{REQUEST_URI} or some other variable.

mokuril

12:57 pm on Sep 15, 2005 (gmt 0)

10+ Year Member



Ok thought there was a problem with the HTTP_HOST, I have rewritten the .htaccess, but still the same problem.

RewriteCond %{HTTP_HOST} ^example\.com回user\.provider\.org
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^web\.provider\.org
RewriteCond %{REQUEST_URI} ^/~user
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

web.provider.org/~user turns into www.example.com//home/user/www
web.provider.org/~user/(...) works perfect

Probably I'm missing some of the basics, but I can't figure out what...

[edited by: jdMorgan at 2:22 pm (utc) on Sep. 15, 2005]
[edit reason] Example.com [/edit]

jdMorgan

2:23 pm on Sep 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is this code in .htaccess or httpd.conf?

Jim

mokuril

2:34 pm on Sep 15, 2005 (gmt 0)

10+ Year Member



.htaccess

(i have no privileges to access httpd.conf)