繁体   English   中英

URL wordpress末尾的斜杠

[英]Trailing slash at end of URL wordpress

亲爱,

我想在站点的每个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_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]
</IfModule>

请指教。

谢谢

在您的默认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]

确保使用新的浏览器进行测试。

暂无
暂无

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

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