开发者

.htaccess being ignored in sub-directory

I'm trying to get my .htaccess file to work from the root, but also use RewriteRule for a sub-directory.

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_URI} !^/admin/index.php$ [NC]
    RewriteRule ^admin/(.*)$ /admin/index.php?_pd=$1 [QSA,L]
    RewriteRule ^(.*)$ /index.php?_pd=$1 [QSA,L]
</IfModule>

However I get 404 errors when trying to access /admin/login etc etc. This kind of works:

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCon开发者_StackOverflow中文版d %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?_pd=$1 [QSA,L]

    RewriteCond %{REQUEST_URI} !^/admin/index.php$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^admin/(.*)$ /admin/index.php?_pd=$1 [QSA,L]
</IfModule>

But not how it should do. Some things work, some don't.


This was actually caused because I had missed out on including that there is an ErrorDocument in the .htaccess apparently, since the admin folder didn't include this same document, it wasn't following the rules like it should, and trying to supply me with that file instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜