Redirection & Dns problem

May 10, 2015 1.8k views
DNS LAMP Stack Ubuntu

My droplet, 12.04.5 x64 , Lamp works fine, but i want that the users can acces by directly to the forum (without the /forum)

how can i make it?
thanks in advance for your attention

1 comment
  • 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 ^/$
    RedirectMatch ^/index.html$
    RewriteBase /forum/
    RewriteCond %{REQUESTFILENAME} !-f
    RewriteCond %{REQUEST
    FILENAME} !-d
    RewriteRule . /forum/index.php [L]

    You might need to enable mod_rewrite first to make it work as expected.

1 Answer

Append /forum to your DocumentRoot or move your files one directory up.

Have another answer? Share your knowledge.