本文介绍了从站点中的所有 URL 中删除尾部斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对整个 .htaccess 有点陌生,我一直在尝试修改它,以便我的所有链接都不会在其各自 URL 的末尾带有斜杠.我的网站是 filmblurb.
I'm kind of new to the whole .htaccess thing and I've been trying to modify it so that none of my links will have trailing slashes at the end of their respective URLs. My website is filmblurb.
Wordpress 开始和结束的 .htaccess 代码如下所示:
The code for the .htaccess where Wordpress begins and ends looks like this:
# 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如果有人能引导我朝着正确的方向解决这个问题,我将不胜感激.谢谢.
I would appreciate it if someone can lead me in the right direction on how to fix this. Thanks.
推荐答案您可以添加一个 RewriteRule 来消除尾部斜杠:
You can add a RewriteRule to eliminate the trailing slash:
RewriteRule ^(.*)/$ $1 [R=301,L]更多推荐
从站点中的所有 URL 中删除尾部斜杠
发布评论