mod_rewrite: How to pass anything after the first slash as a variable
Posted on 2009-04-02
I have a very simple question. What is the .htaccess code that converts the following:
http://www.mysite.com/whatever ---> http://www.mysite.com/index.php?param=whatever
"whatever" can be anything and include letters, numbers, etc. For example:
http://www.mysite.com/1234 ---> http://www.mysite.com/index.php?param=1234
http://www.mysite.com/help.htm ---> http://www.mysite.com/index.php?param=help.htm
Basically, I want WHATEVER comes after the slash, to be passed as a GET variable to index.php.
The URL should remain as "http://www.mysite.com/whatever" even though it's doing the server-side translation.