.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.
精彩评论