Reputation: 4313
What is the fastest way to beautify my urls?
I always have a single id ('page'). I want the url to be www.mysite.com/page
Thanks
Upvotes: 0
Views: 155
Reputation: 1126
I prefer using .htaccess to send all non-static requests to index.php and parse the $_SERVER['PATH_INFO']
variable and determine what code to run based on that, but in your case the easiest way may be to use mod_rewrite as already stated.
Upvotes: 0
Reputation: 48304
Several options:
mod_rewrite is the most complex to understand in its entirety, but it is (presumably) the most efficient method of the above and can do the most with the least amount of PHP code required.
Upvotes: 0
Reputation: 70721
Assuming your website runs on Apache, you can use mod_rewrite.
Simply create a .htaccess
file on your web server with something like this:
RewriteEngine On
RewriteBase /
RewriteRule (.*) index.php?page=$1
Upvotes: 6