dqhsv0147421 2015-06-15 13:40
浏览 101
已采纳

将子域重定向到其子文件夹,Safari显示尝试打开时发生了太多重定向

Possible Duplicate

I did the same. But instead of using .htaccess I put these lines

RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com  
RewriteRule ^(.*)$ /folder/$1 [R=301]

to /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/$1 [R=301]
</VirtualHost>

After restarting apache2, When I browse one.domain.com , Mozzila, IE Chrome not responding, But safari gives error

Safari Error

  • 写回答

1条回答 默认 最新

  • dongpin1059 2015-06-15 14:30
    关注

    Since it's a 301 you're telling the browser to redirect to one.domain.com/folder which still passes your host condition. Meaning on redirect 2 you're on page one.domain.com/folder/folder

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?