php - URL Routing with get variables -
i want shorten url from:
localhost/group.php?(get_request_variable_here)
to
localhost/(get_request_variable-value)
essentially this:
localhost/group.php?id=7 localhost/7
i using php , i'm guessing need htaccess file.
this question has been asked on site lot. e.g. rewrite queries not need .php extension using mod_rewrite rewriterule
but answer question. if using apache web server correct, need .htaccess file. work sufficiently:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ index.php [l] </ifmodule>
this reroute requests not actual files index.php file. of course require implement routing logic in index file, determine page want access, how achieve pretty urls.
Comments
Post a Comment