Jump to content

Htaccess Redirect - retain links - move folder to root


Recommended Posts

If you have recently moved your forums or other software from a folder to the root directory, you can put this in an .htaccess file in your old folder to redirect all traffic and retain the links to the new location.


In this example the old folder would be "forum" and of course edit www.mysite.com to your own url.

Options +FollowSymLinks
RewriteEngine On
redirect 301 /forums http://www.mysite.com
Link to comment
Share on other sites

If you have forums as the default app, and had the site in /forum (note no s) then redirecting all as above won't work as the /forum url is used internally, in that case for IPS 4+ you can redirect specific urls as below.

(adjust as needed for your apps/community)

Options +FollowSymLinks
RewriteEngine on
redirect 301 /forum/topic https://www.yoursite.com/topic
redirect 301 /forum/gallery https://www.yoursite.com/gallery
redirect 301 /forum/calendar https://www.yoursite.com/calendar
redirect 301 /forum/profile https://www.yoursite.com/profile
redirect 301 /forum/subscriptions https://www.yoursite.com/subscriptions
redirect 301 /forum/discover https://www.yoursite.com/discover
redirect 301 /forum/guidelines https://www.yoursite.com/guidelines
redirect 301 /forum/leaderboard https://www.yoursite.com/leaderboard
redirect 301 /forum/online https://www.yoursite.com/online
redirect 301 /forum/staff https://www.yoursite.com/staff
redirect 301 /forum/store https://www.yoursite.com/store
redirect 301 /forum/privacy https://www.yoursite.com/privacy
redirect 301 /forum/contact https://www.yoursite.com/contact
redirect 301 /forum/blog https://www.yoursite.com/blog
redirect 301 /forum/files https://www.yoursite.com/files
redirectMatch 301 ^/forum/$ https://www.yoursite.com/


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...