A simple way to redirect http://mysite.com to http://mysite.com/mylink with Apache?
Posted
by
Bart Silverstrim
on Server Fault
See other posts from Server Fault
or by Bart Silverstrim
Published on 2011-06-30T15:15:42Z
Indexed on
2011/06/30
16:24 UTC
Read the original article
Hit count: 288
Just starting to try to get the hang of how all the directives and options work under Apache.
I'd like to do a redirect with my one site (only running one site on the server) so that when a request comes in to http://mysite.com the server automatically redirects them to a sub-url of http://mysite.com/mylink.
I have tried putting redirects into the file located in /etc/apache2/sites-enabled to rewrite this, but then the top level domain URL complains it isn't redirecting properly.
I think what I want is a browser redirect, and thought using
RewriteEngine On
RewriteRule ^/$ /mylink [L,R]
would work, but putting it into an .htaccess file didn't work (it redirected but immediately gave a 500 internal server error.)
Putting it into the file in /etc/apache2/sites-enabled gives a configuration error when trying to restart Apache.
I know it's something simple...but what am I missing?
© Server Fault or respective owner