Welcome to WebmasterWorld Guest from 35.171.45.91

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

mod_rewrite help needed

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 21, 2003
posts:899
votes: 1


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]

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

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 21, 2003
posts:899
votes: 1


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)

Inactive Member
Account Expired

 
 


I could be wrong - but how about adding " [R]" to the end of the RewriteRule?
4:03 pm on Jan 8, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 21, 2003
posts:899
votes: 1


>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.

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

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


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