.htaccess - How do I redirect dynamic URLs with parameters? -


the old urls this: http://mywebsite.com/index.php?mode=thread&id=284607

the new urls be: http://mywebsite.com/threads/284607

as can see, want grab id # old dynamic urls , point them new pretty urls.

i've tried finding solution here , elsewhere, keep having problems removing "mode=thread" part redirect.

thanks help!

update: here's other code in .htaccess file.

rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [nc,l] rewriterule ^.*$ index.php [nc,l] 

after lot of googling, found work:

rewritecond %{query_string} (^|\?)mode=thread&id=([0-9]+)($|&) rewriterule ^index\.php$ http://mywebsite.com/threads/%2/? [r=301,l] 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -