.htaccess Redirect Old Threads

.htaccess Redirect Old Threads - .htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, redirects, , , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :


I have moved to mybb to vanilla and want to redirect old threads to the new format, so the indexed threads on Google aren't lost.



The old format is



showthread.php?tid=3003


Whereas the new format is



index.php?p=/discussion/3003


How would I redirect this via .htaccess?


Solution :

You will want to use a 301 redirect (permanently moved) so that google will update its indexes with the new URLS, as users are redirected.



RewriteEngine on
RewriteBase /
RewriteCond %QUERY_STRING tid=([0-9]*)$
RewriteRule showthread.php index.php?p=/discussion/%1 [L,R=301]

Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.

Comments

Popular posts from this blog

Rewrite in Mediawiki, remove index.php, .htaccess

.htaccess rewrite wildcard folder paths from host

Using .htaccess to set a cookie and 301 redirect