Php URL wordpress末尾的尾随斜杠
亲爱的 我想在网站的每个url的末尾添加/以下是我在网上找到的内容,它很好用,但在wp admin中它给了我Php URL wordpress末尾的尾随斜杠,php,wordpress,.htaccess,Php,Wordpress,.htaccess,亲爱的 我想在网站的每个url的末尾添加/以下是我在网上找到的内容,它很好用,但在wp admin中它给了我wp admin/index.php/index.php/。就像我每次单击仪表板一样,它会添加/index.php/ 来自htaccess的代码 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FIL
wp admin/index.php/index.php/
。就像我每次单击仪表板一样,它会添加/index.php/
来自htaccess的代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]
</IfModule>
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_URI}!(.*)/$
重写规则^(.*)$http://%{http_HOST}/$1/[L,R=301]
请告知
谢谢在默认WP规则之前保留重定向规则:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
请确保使用新的浏览器进行测试。我不确定上述代码是否正确,如果添加了“否”,则会在页面上显示“未找到”。没问题。但后来我修改了规则,从我的帖子喜欢
RewriteRule^(.*)$http://%{http_HOST}/$1/[L,R=301]
。而且wp admin没有给出multiple index.php。谢谢你解释一下重写规则与我添加的规则之间的区别。谢谢,我忘了在我的规则中的%{REQUEST\u URI}
之后添加/
。现在已经编辑好了,应该可以用了%{REQUEST_URI}
是保留的mod_rewrite
变量,其值为complete REQUEST URI。如果您的站点root.htaccess中有此规则,则RewriteRule
之后的(.*)
也将具有不带前导斜杠的完整请求URI值。