Question
Redirection & Dns problem
My droplet, 12.04.5 x64 , Lamp
mywebsite.com/forum works fine, but i want that the users can acces by mywebsite.com directly to the forum (without the /forum)
how can i make it?
thanks in advance for your attention
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
If you don’t want the /forum in the URL, then yeah, do something like:
cd [webroot directory]
cd .. #go up one directory
mv htdocs htdocs-old
mv htdocs-old/forum htdocs
If you have a lot of absolute links (i.e., href=“/forum…”) that break, put things back where they were, and do some URL rewriting, maybe something similar to this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/index.html$ /forum/ [R]
RedirectMatch ^/$ http://mywebsite.com/forum/
RedirectMatch ^/index.html$ http://mywebsite.com/forum/
RewriteBase /forum/
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUESTFILENAME} !-d
RewriteRule . /forum/index.php [L]
You might need to enable mod_rewrite first to make it work as expected.