Pergunta

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?

Foi útil?

Solução

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]

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top