【发布时间】:2016-03-22 17:25:26
【问题描述】:
我正在尝试为使用 Yii2 框架开发的网站创建干净的 url,仅使用 .htaccess。我知道我可以使用 Yii2 的 urlmanager 类。但由于某些特定原因,我无法使用它,只想使用 .htaccess 制作干净的 url。
我想转换以下网址: 网址 = 'http://localhost:8090/index.php?r=site%2Fcontact' 至 网址 = 'http://localhost:8090/contact'
提前致谢。
【问题讨论】:
-
从未尝试过这样做,但您只想要一个控制器?
-
不,我想对所有控制器都这样做。
-
那么你显然需要它是 localhost:8090/site/contact。但只要你不能编辑 yii 文件,这不是 yii 问题。尝试阅读 apache .htaccess 文档。
标签: php apache .htaccess mod-rewrite yii2