I have following problem. My .htaccess looks like this
RewriteEngine On
RewriteBase /phpuserarea/
RewriteCond %{REQUEST_URI} !^mod/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1?%{QUERY_STRING} [L]
ErrorDocument 404 /phpuserarea/404/index.php
But whenever I try to directly access anything in the mod
directory the server responds with 404.
Other problem is, that besides the index.php I want to allow direct access to let's say testa.php and testb.php
Those are my ajax files and I can't seem to find a solution.
Have it this way:
ErrorDocument 404 /phpuserarea/404/index.php
RewriteEngine On
RewriteBase /phpuserarea/
RewriteCond %{REQUEST_URI} !/mod/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
You need leading slash in RewriteCond %{REQUEST_URI}
and better not use anchor ^
as your .htaccess is inside /phpuserarea/
.
Also you don't need to use ?%{QUERY_STRING}
in target since query string is automatically passed over to target if your rule doesn't overwrite it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.