0

I am trying to set {mydomain}/forum to be the default URL that people are brought to when they go to {mydomain}. I have this working, as in my .htaccess I wrote DirectoryIndex index.php?route=/forum/ (this is the less simplified version of /forum, both work. just putting "forum" didn't work so I replaced it with this). The problem is that it doesn't redirect them to /forum, it just keeps them on /. It shows the right page, but doesn't have /forum in the URL.

How can I fix this?

  • Redirecting away from the root URL isn't common practice because it doesn't look good. Why do you want to do it? – Stephen Ostermiller Jun 26 at 21:49
  • Is /forum a physical subdirectory? Do you have any other directives or any other .htaccess files? – MrWhite Jun 26 at 21:52
  • @StephenOstermiller the problem is if they go to the website, they see {mydomain}. then if they go somewhere else and then click the link to Forum, they see {mydomain}/forum. i don't like that the same page can show two URLs like that – Jaoowp Jun 26 at 21:58
  • I would choose the simpler URL as the canonical and eliminate the /forum URL instead. – Stephen Ostermiller Jun 26 at 22:03
  • @StephenOstermiller I am using a forum builder and to be honest I'm not really sure how, other than adding a header(Location:{mydomain}); perhaps. – Jaoowp Jun 26 at 22:27
1

I don't normally like to redirect away from the root but if that is your goal try this.

RewriteEngine On
RewriteRule ^$ /forum [L]

This Question on StackOverflow should get you what you need.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.