Soubhagya Kumar Barik
Soubhagya Kumar Barik

Reputation: 2595

Virtual host redirection not working in apache

i have created a simple virtual domain http://team.xyz.ae once i hit this URL i want to redirect this to http://team.xyz.ae/users/login but now its redirecting to

http://team.xyz.ae/users/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/loginusers/login

this is what i have written to create a virtual host

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/xyz/
    Redirect permanent / http://team.xyz.ae/users/login
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Upvotes: 0

Views: 2783

Answers (1)

Alan Birtles
Alan Birtles

Reputation: 36409

See https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect, Redirect redirects any request starting with the given URL.

You probably want to use RedirectMatch instead:

RedirectMatch permanent "^/$" http://team.xyz.ae/users/login

Upvotes: 2

Related Questions