嗨,我是不是由任何发挥想象力的程序员,我试图基于以下做多301重定向在我的htaccess文件:的.htaccess重定向子文件夹
所以我有一吨的网址都具有类似的命名约定 - 这里是2
http://www.hollandsbrook.com/garrett-at-gold/
http://www.hollandsbrook.com/garrett-ace-250/
这些网址需要重定向到一个样本:
http://www.hollandsbrook.com/garrett-metal-detectors/garrett-at-gold/
http://www.hollandsbrook.com/garrett-metal-detectors/garrett-ace-250/
我可以重定向他们1线的时间,但我喜欢使用正则表达式。
这里是我至今想,但不工作:
重写规则^加勒特 - ([AZ])/ $ /加勒特金属探测器/ $ 1/[R]
基本上我需要将任何页面从以“garrett-”开头的根目录重定向到包含“garrett-metal-detectors”文件夹路径。
任何想法将非常赞赏。非常感谢您的帮助。
活计,你摇滚!我意识到我不想重定向类别页面(garrett-metal-detectors),所以我对你的代码做了轻微的修改: ewriteRule^garrett \ - ([a-ln-z \ - ] +)/?$/garrett-metal-detectors/garrett- $ 1/[R = 301,L] 再次感谢! – user962876
你走了!你欢迎 –
马甲回答如何? – Tech4Wilco