WordPress重写规则与真实路径和文件名冲突


Wordpress rewrite rules conflicting with real paths and filenames

我正在重新创建我的雇主网站,它目前使用WordPress,

我在/public_html/文件夹中创建了一个名为 dev 的新目录。当dev文件夹为空时 - 它将按预期显示目录内容。当我把一个index.php文件扔进去的那一刻,我被送回404错误。

index.php的内容很简单<h1>Working</h1>

查看主目录的 .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

如果请求的文件名实际上是真实的文件或目录,则似乎应该已经忽略了该规则。

整个 .htaccess 文件。

RewriteEngine on
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName ant.com.au
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<Files 403.shtml>
order allow,deny
allow from all
</Files>

绝对看起来尝试导航到文字目录和/或文件应该没有任何冲突

任何帮助都非常感谢

这实际上很容易修复:

我刚刚添加了一个重写条件:RewriteCond %{REQUEST_URI} !^/dev/

完全重写:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_URI} !^/dev/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>