How to redirect root directory to virtual or any other directory on Apache

 

The configuration files are at /etc/httpd/conf.d , just add to welcome.conf the directive :

Use RedirectMatch to only redirect the root URL “/” to another sub-directory or URL, without also redirecting everything else…

RedirectMatch ^/$ http://www.example.com/another/path

Since RedirectMatch uses a regex match, it can be specific with the “/” path without matching anything else.

 

Leave a Reply

Your email address will not be published. Required fields are marked *