This question already has an answer here:
I've searched a lot, but couldn't find a solution. I'm trying to redirect php based urls with parameters to SEO friendly urls.
For example I want to redirect static.php?content_id=27 to /presentation/, but I get infinite loop error.
Here is my code:
RewriteEngine On
RewriteBase /
RewriteRule ^presentation/$ static.php?content_id=27
RewriteCond %{QUERY_STRING} content_id=27
RewriteRule ^static\.php$ /presentation/? [L,R=301]
The old urls are indexed by google so I need this redirect.
Thanks
</div>
Try this :
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} /static\.php\?content_id=27 [NC]
RewriteRule ^ /presentation/? [NC,R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ /static.php?content_id=27 [NC,QSA,L]