【问题标题】:.htaccess rewrite to subdir can't find its subdirs.htaccess 重写子目录找不到它的子目录
【发布时间】:2011-08-24 13:28:09
【问题描述】:

我即将因 .htaccess 问题而失去理智,我显然无法解决。

我想要完成的是:

rewrite: example.com -> www.example.com -> /subdir/

到目前为止我得到的是:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^$ /subdir/$1 [L]

这可行,但是服务器在子目录中找不到子目录,例如 (/subdir/)css 目录。

希望有人能帮忙

【问题讨论】:

    标签: .htaccess rewrite subdirectory


    【解决方案1】:

    在我看来,最后一行应该是

    RewriteRule ^(.*)$ /subdir/$1 [L]
    

    另外,如果你在 [R=301,L] 中省略 L,它应该会快一点(最后理论上)。

    【讨论】:

    • 好吧,我无法解释“永久移动”页面,但我为你感到高兴
    • 嗨 Jannis,抱歉,刷新浏览器缓存后出现内部服务器错误。
    • 您可以发布您的新 .htaccess 内容吗?也许是打字的东西?
    猜你喜欢
    • 2012-05-06
    • 2012-01-26
    • 1970-01-01
    • 2010-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-25
    • 1970-01-01
    相关资源
    最近更新 更多