I have a vhost that needs to redirect /
to /app
and I use following to accomplish that in vhost.conf:
RewriteEngine On
RewriteRule ^/$ /app [R]
but it's giving me hard time since users get http://server.com//app address.
How to fix that?
I have a vhost that needs to redirect /
to /app
and I use following to accomplish that in vhost.conf:
RewriteEngine On
RewriteRule ^/$ /app [R]
but it's giving me hard time since users get http://server.com//app address.
How to fix that?
suku@ubuntu-vm:/var/www/local$ grep Redirect /etc/apache2/sites-available/default
RedirectMatch ^/$ /app
suku@ubuntu-vm:/var/www/local$ curl http://127.0.0.1/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://127.0.0.1/app">here</a>.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at 127.0.0.1 Port 80</address>
</body></html>
It seems like after redirecting, the application itself redirects the page to /login
.
So to avoid double redirect simply redirect the root /
to the correct page and add this to the apache config in your /etc/apache/sites-available/vhost.conf
:
RewriteEngine On
RewriteRule ^/$ /app/login.axvw [R]