I want to have the URL http://something.com/somestring where the somestring is picked up by the php $_GET, instead of having to write http://something.com/index.php?var=somestring and inside php using $_GET["var"].
How do I do it?
I want to have the URL http://something.com/somestring where the somestring is picked up by the php $_GET, instead of having to write http://something.com/index.php?var=somestring and inside php using $_GET["var"].
How do I do it?
If you are running on Apache, you can use mod_rewrite. Other servers have different methods, but the general term us 'URL rewriting' to describe this functionality.
Your question has already been answered. But to give you the common example for your case:
RewriteEngine
RewriteCond ./%{REQUEST_URI} !-f
RewriteRule ^(\w+)$ index.php?var=$1 [L]
The first cond prevents the rule from rewriting requests to real files. The second takes any alphanumeric string and appends it as GET parameter to your script.
You can use .htaccess and mod_rewrite to do this, assuming you are using apache as webserver -> http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Another option would be using the $_SERVER["QUERY_STRING"]
http://something.com/index.php?=somestring
$_SERVER["QUERY_STRING"] would return "somestring"