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
https://forums.phpfreaks.com/topic/95724-mod-rewrite/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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