简体   繁体   English

URL wordpress末尾的斜杠

[英]Trailing slash at end of URL wordpress

Dears, 亲爱,

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/ . 我想在站点的每个URL末尾添加/,这是我在网上找到的,效果很好,但是在wp-admin中,它给了我wp-admin/index.php/index.php/ Like everytime i click on dashboard it will add /index.php/ 就像每次我在仪表板上单击一样,它将添加/index.php/

code from htaccess 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>

Please advise. 请指教。

Thanks 谢谢

Keep redirect rule before your default WP rule: 在您的默认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]

Make sure to use a new browser for your testing. 确保使用新的浏览器进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM