forums.php?m=topics&s=15
to this
forum-topics-c15.html
and I have so far this
- Code: Select all
RewriteRule ^forum-topics-c([^/]*)\.html$ /forums.php?m=topics&s=$1 [NC,NE,L]
but I want to add a 301 rule to make it permanently redirect to new format. I know how to make it work with 1 'variable', for example if the query was only forums.php?m=topics, the command should be something like
- Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?m=([^&]+)&.*)?$ [NC]
RewriteRule ^forums\.php$ /forum-%2.html? [R=301,L]
but what happens with more variables?
I tried this
- Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?m=([^&]+)&s=([^&]+)(&.*)?$ [NC]
RewriteRule ^forums\.php$ http://www.fmscout.com/forum-%2-c%3.html? [R=301,L]
with no luck.
thanks in advance for your time
EDIT:
I studied the forums for some hours and I think I made it work
- Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?m=topics(&.*)?$ [NC]
RewriteCond %{QUERY_STRING} ^(.*&)?s=([^&]+)(&.*)?$ [NC]
RewriteRule ^forums\.php$ /forum-topics-c%2.html? [R=301,L]