【发布时间】:2015-05-26 16:50:47
【问题描述】:
我需要修改我的 .htaccess 以执行下一个重定向:
http://www.example.com/en/region1/subregion1/subregion2
到
http://www.example.com/en/example.php?param1=region1¶m2=subregion1¶m3=subregion2
对我来说问题是原始 URL 可以有这 3 种不同的结构:
/region1/
/region1/subregion1/
/region1/subregion1/subregion2
我想要的是在变量中转换这个子目录,无论它们是 3 还是只有 1。
如何使用 mod_rewrite 实现这一点?
谢谢
【问题讨论】:
标签: php apache .htaccess mod-rewrite