Shorten a long url for users in .htaccess -


how shorten

 example.com/user.php?name=foo&id=20  

to

example.com/foo/20  

?

i on free webhost , htaccess file has 2 lines

rewriteengine on  rewritebase / 

please help

try this:

rewriteengine on rewritebase / rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([a-za-z0-9]+)/([a-za-z0-9]+)/?$ /user.php?name=$1&id=$2 [qsa,nc,l]  

rewritecond checks if requested filename directory or file , passed unchanged , rewriterule skipped.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -