FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


problem with get variables!





alalex
Hi everyone, I am using a kind of .htaccess redirection to make my urls more friendly for the user, the thing is it is a community site, and so I changed /userinfo.php?user=username to /username
Here is the code I used to achieve this:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [S=44]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=44]
RewriteRule ^(.*)$ /userinfo.php?user=$1

Now the problem is that when I pass variables like: /username?var1=whatever&var2=whatever it doesnt work, they dont seem to get redirected!

I need someone that understands better than me Wink that .htaccess code to rewrite it so that it will allow those variables!
Thanks a lot!
phpc0d3r
Try This:
Code:
# this is the initialization
Options         +FollowSymLinks
RewriteEngine   On

# these are the rewrite conditions
RewriteCond     %{REQUEST_FILENAME}     !-f
RewriteCond     %{REQUEST_FILENAME}     !-d

# and finally, the rewrite rules
RewriteRule     ^([a-zA-Z0-9\-]+)/?$    /userinfo.php?user=$1 [L,QSA]
alalex
thanks a lot!
now it works Wink
kewiin
Thx this works great!
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.