Question

I updated a webforum which causes the old urls to be invalid. The old structure was:

www.myforum.com/index.php?page=Thread&threadID=34541/

the new structure has to be:

www.myforum.com/index.php/Thread/34541

Can you please provide me the .htaccess-rule for that?

Was it helpful?

Solution

add the following rules to your .htaccess (in the root directory of your website)

RewriteCond %{QUERY_STRING} ^page=(.+?)&threadID=(\d+)/?$ [NC]
RewriteRule ^index\.php$ /index.php/%1/%2? [NC,R=301,L]

OTHER TIPS

RewriteEngine On
RewriteCond %{QUERY_STRING}   ^page=Thread&threadID=(\d+)/?$
RewriteRule .*  index.php/Thread/%1   [L]

Please note that this rule redirects internally. for external redirect use R flag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top