Reputation: 553
The thing I ask for is truly simple. I want to get from this:
http://test.com/index.php?articles=mynewarticle&id=5
to this:
http://test.com/mynewarticle.html
and I don't understand why, but the following .htaccess is not doing the job:
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /index.php?articles=$1&id=5 [L]
When I type in
http://test.com/index.php?articles=mynewarticle&id=5
I get
http://test.com/index.php?articles=mynewarticle&id=5
Not sure if something is modified in Apache in the way that disables this option for me and I don't know where to check this. Thanks in advance for any of the help provided.
Upvotes: 0
Views: 289
Reputation: 41219
You need a combination of external and internal RewriteRules to convert orignal url into SEO friendly format
RewriteEngine on
#redirect "/index.php?articles=foobar&id=123" to "/foobar.html"
RewriteCond %{THE_REQUEST} /index\.php\?articles=([^&]+)&id=.+ [NC]
RewriteRule ^ /%1.html [NE,L,R]
#rewrite "/foobar.html" to "/index.php?articles=foobar&id=5
RewriteRule ^([^/]*)\.html$ /index.php?articles=$1&id=5 [L]
Upvotes: 1