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
Post a Comment