多年前,我在我的网站上的多个子目录中安装了链接构建程序。挑选的蜘蛛拿起地址,直到今天他们出现了。
我可以使用13种不同的RewriteRules重定向它们,但我需要为13个子目录执行此操作。有没有办法在没有169行代码的情况下实现这一目标?
RewriteRule ^adult/join/ http://www.domain/adult/ [R=301,L]
RewriteRule ^adult/stats/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/details/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/overall-stats/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/lost_pw/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/review/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/reviews/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/rank/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/search/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/category/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/user_cpl/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/page/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^adult/app/ http://www.domain.com/adult/ [R=301,L]
RewriteRule ^teen/join/ http://www.domain/teen/ [R=301,L]
RewriteRule ^teen/stats/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/details/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/overall-stats/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/lost_pw/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/review/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/reviews/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/rank/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/search/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/category/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/user_cpl/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/page/ http://www.domain.com/teen/ [R=301,L]
RewriteRule ^teen/app/ http://www.domain.com/teen/ [R=301,L]
然后为^ gay ^ gayteen ^ senior ect。
答案 0 :(得分:0)
您可以使用:
RewriteRule ^(adult|teen|gay|gayteen|senior)/(?:join|stats|details|overall-stats|lost_pw|reviews?|rank|search|category|user_cpl|page|app)/? http://www.domain.com/$1/ [NC,R=301,L]
只有一行; - )
编辑:使用域名选项:
RewriteRule ^((?:adult|teen|gay|gayteen|senior)/)?(?:join|stats|details|overall-stats|lost_pw|reviews?|rank|search|category|user_cpl|page|app)/? http://www.domain.com/$1 [NC,R=301,L]