htaccess 删除 url 中的重复名称

发布于 2024-12-12 22:50:40 字数 923 浏览 0 评论 0原文

我有这个页面,如果您滚动到页面中间,您会看到许多链接全部都有重复的名称,例如

http://healingstreamsusa.org/healing/healing/good-grief.html
http://healingstreamsusa.org/healing/healing/forgiveness-not-option.html

,正如您所看到的,有两个治疗/治疗而不是一个治疗/,因此网址全部损坏,并且站点范围内有很多...客户端将所有网址设置为相对网址而不是绝对网址,现在他需要一个htaccess这将删除中间的重复项...这是我所拥有的,它并没有按照我的预期进行重定向...我是否错过了一些东西

RewriteCond %(REQUEST_URI) ^/healing/healing[/]?
RewriteRule (.*) http://healingstreamsusa.org/healing? [R=301,L]

尝试了所有这些...

RewriteRule /about/about/(.+)$ /about/$1 [R=301]
RewriteRule /about/images/(.+)$ /images/$1 [R=301]
RewriteRule /healing/images/stories/(.+)$ /images/stories/$1 [R=301]
RewriteRule /healing/healing/(.+)$ /healing/$1 [R=301]
RewriteRule ^healing/healing/([^/]*)$   /healing/$1

知道为什么这不起作用。 ...

I have this page and if you scroll to the middle of the page you will see many links that all have duplicate names like for example

http://healingstreamsusa.org/healing/healing/good-grief.html
http://healingstreamsusa.org/healing/healing/forgiveness-not-option.html

As you can see there are two healing/healing instead of the one healing/ so the urls are all breaking and there are many sitewide...The client made all the urls relative instead of absolute and now he needs an htaccess that will remove the duplicates in the middle....here is what i have and its doesnt do the redirect as i expected....am i missing something

RewriteCond %(REQUEST_URI) ^/healing/healing[/]?
RewriteRule (.*) http://healingstreamsusa.org/healing? [R=301,L]

Tried all these.....

RewriteRule /about/about/(.+)$ /about/$1 [R=301]
RewriteRule /about/images/(.+)$ /images/$1 [R=301]
RewriteRule /healing/images/stories/(.+)$ /images/stories/$1 [R=301]
RewriteRule /healing/healing/(.+)$ /healing/$1 [R=301]
RewriteRule ^healing/healing/([^/]*)$   /healing/$1

Any idea why this would not work....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明媚如初 2024-12-19 22:50:40
RewriteEngine On
RewriteRule ^healing/healing/([^/]*)$   healing/$1
RewriteRule ^about/about/([^/]*)   about/$1
RewriteEngine On
RewriteRule ^healing/healing/([^/]*)$   healing/$1
RewriteRule ^about/about/([^/]*)   about/$1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文