All kind of tutorials on the net suggest that can be done. I tried this one: http://www.webreference.com/programming/Mod_Rewrite02 which explains how to "translate" URLs: http://www.example.com/library/bookinfo.php?section=biology&bookid=4856 Code (markup): to http://www.example.com/library/biology/4856 Code (markup): I need to do the same thing: http://localhost/index.php?news=7 Code (markup): to http://localhost/news/7 Code (markup): thanks
I tried this code for htaccess but didn't do anything to URLs: Options +FollowSymLinks RewriteEngine on RewriteRule test(.*)\.htm$ /index.php?news=$1
Is the apache configured to allow override from .htaccess... also... note your .* is doing a greedy match.. you be better off with lazy match... test(.*?)\.htm$
Yes, it's enabled. this code RewriteRule test(.*?)\.htm$ /index.php?news=$1 didn't do anything either
There is correction (no need of / before index.php) RewriteRule ^news/([0-9]+)/?$ index.php?news=$1 This will not change the URL in your code (were you expecting this?). After using this code in .htaccess you can access this URL e.g. http://localhost/news/7