将子域重定向到其子文件夹,Safari 显示尝试打开时发生太多重定向
Redirecting subdomain to its sub folder, Safari showing too many redirect occured trying to open
我也是这样做的。但是我没有使用 .htaccess
,而是把这些行
RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com
RewriteRule ^(.*)$ /folder/ [R=301]
至/etc/apache2/sites-available/default。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All // I even changed None to All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All // I even changed None to All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com
RewriteRule ^(.*)$ /folder/ [R=301]
</VirtualHost>
重启apache2后,浏览one.domain.com
,Mozzila,IE Chrome没有响应,但是safari报错
因为它是 301,您告诉浏览器重定向到 one.domain.com/folder,它仍然通过您的主机条件。重定向 2 的意思是您在页面 one.domain.com/folder/folder
我也是这样做的。但是我没有使用 .htaccess
,而是把这些行
RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com
RewriteRule ^(.*)$ /folder/ [R=301]
至/etc/apache2/sites-available/default。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All // I even changed None to All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All // I even changed None to All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com
RewriteRule ^(.*)$ /folder/ [R=301]
</VirtualHost>
重启apache2后,浏览one.domain.com
,Mozzila,IE Chrome没有响应,但是safari报错
因为它是 301,您告诉浏览器重定向到 one.domain.com/folder,它仍然通过您的主机条件。重定向 2 的意思是您在页面 one.domain.com/folder/folder