0
问题:存在与/ page /相同的URL,但带有一些文件扩展名,即/page.xml,导致404/for/page /。.htaccess规则导致/ page/if /page.[ext]存在404错误
因此,例如,我的HTML站点地图example.com/sitemap将存在404如果example.com/sitemap.xml存在。
我的Wordpress站点的.htaccess文件包含重写条件,如预期的那样,以example.com/page的形式向页面添加尾部斜线,因此它们被重写为example.com/page/。
的.htaccess如下:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301]
# 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
# BEGIN MainWP
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^wp-content/plugins/mainwp-child/(.*)$ /wp-content/plugins/THIS_PLUGIN_DOES_NOT_EXIST [QSA,L]
</IfModule>
# END MainWP
禁用'MultiViews'? – Walf