Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite help needed

         

Zygoot

6:37 pm on Jan 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The thing I want to achieve is this :
my users need to be able to reach the long and boring http://www.mydomain.net/user.php?name=username URL trough this url http://user.mydomain.net/username

Can anybody help me how I can create this? My knowledge about the whole mod_rewrite engine isn't that big, but I tried using the following code.

RewriteEngine on
RewriteRule ^([a-zA-Z0-9]*)$ http://www.mydomain.net/user.php?name=$1

It works, but it redirects the user to the www.mydomain.net domain. However, I want it to keep the user.mydomain.net/username url.

Any help is appreciated.

[edited by: jdMorgan at 2:34 am (utc) on Jan. 8, 2004]
[edit reason] de-linked [/edit]

jdMorgan

12:17 am on Jan 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Zygoot,

It is unclear how you wish to map from the new shorter URL to the longer one.

In your target URL (http://user.mydomain.net/username) you have the subdomain "user".

What part of the original URL (http://www.mydomain.net/user.php?name=username) do you want to extract the "user" information from?

Jim

Zygoot

11:31 am on Jan 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I want to extract the 'username' part of the original URL from the 'username' in the other URL (http://user.mydomain.net/username)

dcrombie

1:47 pm on Jan 8, 2004 (gmt 0)



I could be wrong - but how about adding " [R]" to the end of the RewriteRule?

Zygoot

4:03 pm on Jan 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>I could be wrong - but how about adding " [R]" to the end of the RewriteRule?

I have just tried it but it still jumps to the original URL.

jdMorgan

9:05 pm on Jan 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Zygoot,

Please re-read my question above - I am not asking about 'username', I am asking about the subdomain name 'user.' Where do you get the subdomain name from?

Jim