简体   繁体   中英

301 on ServerAlias goes to ServerName domain

I have the following virtual host configuration:

<VirtualHost *:80>
  ServerName www.something.com
  ServerAlias something1.com
  Include conf/vhost/www.something.com-rewrites.conf
</VirtualHost>

Under the www.something.com-rewrites.conf file:

RewriteRule ^/apps/(.*)$ / [R=301,L,E=cache_redirect:1]

If there is a request for something1.com/apps/ , I see that the redirect is happening but the URL is getting changed to www.something.com

I don't understand this strange behavior and also is their any other way that I can prevent this behavior?

听起来您的UseCanonicalName具有非默认值,或者您的客户端为HTTP / 1.0,并且未发送Host:标头。

如果您的站点运行的是像wordpress这样的CMS,它将使用安装它的域作为主域,并且无论您的ServerAlias和ServerMain设置如何,都将重定向到该主域。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM