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 /forum http://www.mysite.com

Share this post

Link to post
Share on other sites

If you have forums as the default app, 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/


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...