Portal Home > Knowledgebase > Articles Database > need help redirect with .htaccess
need help redirect with .htaccess
Posted by kids, 12-04-2011, 07:56 AM |
Hi,
I want to use .htaccess to redirect like this:
http://domain.com/userX -> redirect to http://domain.com/profile.php?user = userX
But I'm very bad in rule making with Mod_Rewrite, please help!
|
Posted by memolipascal, 12-04-2011, 11:57 AM |
htaccess file to create. and
RewriteRule ^userX/([0-9]+)/([^/]*)$ ./profile.php?user = userX [L,NC]
follow this code.
|
Posted by techstubble, 12-05-2011, 07:47 PM |
This should be what you are looking for,
^([0-9a-zA-Z_]+)/?$ profile.php?user=$1
This will work for http://domain.com/userX or http://domain.com/userX/
It also accepts underscores as a valid character in the username.
|
Posted by kids, 12-05-2011, 10:11 PM |
Thanks for your help, and one more can you please tell me more clearly. I'm newbie in mod_rewrite, so I can not do from a to z with it.
Again, thank for all help.
|
Add to Favourites Print this Article
Also Read