URL wordpress 末尾的斜杠 [英] Trailing slash at end of URL wordpress
本文介绍了URL wordpress 末尾的斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的
我想在网站的每个 url 末尾添加/,下面是我在网上找到的,效果很好,但是在 wp-admin 中它给了我 wp-admin/index.php/index.php/代码>.就像每次我点击仪表板一样,它会添加
/index.php/
I want to add / at the end of each url of site, below is what i found online, it works good, but in wp-admin it gives me wp-admin/index.php/index.php/
. Like everytime i click on dashboard it will add /index.php/
来自 htaccess 的代码
code from 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>
请指教.
谢谢
推荐答案
在默认 WP 规则之前保留重定向规则:
Keep redirect rule before your default WP rule:
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]
确保使用新浏览器进行测试.
Make sure to use a new browser for your testing.
这篇关于URL wordpress 末尾的斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文