apache - Treat file name as PHP GET -
i have profiles on test website setup viewed in format:
example.com/profile.php?u=username
i use format:
example.com/profile/username
how treat username
variable in php, rather file?
you need use apache mod_rewrite.
create file named .htaccess
on root of website , add following:
rewriteengine on rewriterule ^/profile/(.*)$ /profile.php?u=$1 [qsa,l]
now, if navigate :
example.com/profile/usertest
apache send variable usertest
profile.php?u=usertest
Comments
Post a Comment