Apache htaccess重定向问题

时间:2015-02-17 08:10:27

标签: apache .htaccess codeigniter mod-rewrite

我有这个htaccess文件:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteRule ^/4b/ / [R=301,L]

    # This portion checks for the presence of maintenance.enable to toggle
    # maintenance mode
    RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
    RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
    RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    RewriteRule ^.*$ /maintenance.html [R=503,L]
    ErrorDocument 503 /maintenance.html
    Header Set Cache-Control "max-age=0, no-store"

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/?$ /index.php?/$1 [L]
</IfModule>

但它与网址http://test.com/4b/http://test.com/4b不匹配 - 相反,它会给我404.我做错了什么?

1 个答案:

答案 0 :(得分:0)

显然,我在/中添加了额外的^/4b/,而它应该只是^4b/