【发布时间】:2015-10-21 14:28:45
【问题描述】:
我正在尝试通过 .htaccess 在 ubuntu 14.04 的 apache2 服务器上重写 url。我有以下网址:
localhost/compare/compares/single/16/postoneVSposttwo
但我想要这样:
localhost/compare/compares/postoneVSposttwo
我已尝试遵循 .htaccess 规则:
RewriteEngine on
RewriteRule ^(.+)/single/.+/(.+)$ $1/$2 [L,NC,R]
但它的网址如下:
localhost/var/www/html/compare/webroot/compares/postoneVSposttwo
我该如何解决这个问题?
【问题讨论】:
标签: regex apache .htaccess url model-view-controller