htaccess删除网址中的重复名称

时间:2011-10-31 02:19:58

标签: .htaccess mod-rewrite redirect

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

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

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

1 个答案:

答案 0 :(得分:0)

RewriteEngine On
RewriteRule ^healing/healing/([^/]*)$   healing/$1
RewriteRule ^about/about/([^/]*)   about/$1