Jump to content

Mod Rewrite.


phpSensei

Recommended Posts

This is actually my first ever using Mod Rewrite, I was finally convinced by people to make my urls (e.g. ?u=Xwer3wr&e=2;c&user=2&ac=1) cleaner.

 

So instead of using "http://www.website.com/users/?user=John" I would like it to be "http://www.website.com/users/John"..

 

So I got this little Mod Rewrite which I don't know if it is correct, I tried it and no luck.

 

RewriteEngine on

RewriteMap      user-to-host   txt:/path/to/map.user-to-host

RewriteRule   ^/u/([^/]+)/?(.*)   http://${user-to-host:$1|server0}/u/$1/$2

RewriteRule   ^/([uge])/([^/]+)/?$          /$1/$2/.www/
RewriteRule   ^/([uge])/([^/]+)/([^.]+.+)   /$1/$2/.www/$3\

 

How would the code know if John is really a username or anything...

 

or

 

I want it to read ?username=John as John only, and so I can use the index.php file to validate the name.

 

edit: Yay, I got back to programming.... It really hunts you back after awhile

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.