【问题标题】:Why redirect keeps changing address bar为什么重定向不断更改地址栏
【发布时间】:2011-03-05 19:24:36
【问题描述】:

代码如下:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/rt/
RewriteRule ^(.*)$ /rt/$1 [L]
</IfModule>

没有[R],但地址栏位置不断变化。 它设置了重定向 302...

我需要将根文件夹更改为 /rt/ 文件夹,但不更改地址栏中的位置。 我不能使用 .htaccess 文件之外的任何东西...

我希望用户访问时: http://domain.com/index.php

http://domain.com/index.php

但打开http://domain.com/rt/index.php

这个 index.php 是示例文件,我需要它适用于每个文件... 无需更改浏览器地址栏中的位置...

【问题讨论】:

    标签: apache .htaccess


    【解决方案1】:

    只用Alias怎么样?

    Alias / /rt
    

    如果没有,请确保您启用了 mod_proxy,然后试试这个:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_URI} !^/rt/
        RewriteRule ^(.*)$ /rt/$1 [PL]
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 2010-11-21
      • 2013-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-09
      • 1970-01-01
      • 2012-10-28
      相关资源
      最近更新 更多