【发布时间】:2015-09-12 13:58:07
【问题描述】:
我遇到了 Apache URL 重写的问题,
当用户录制这样的网址时,我想要:
1:www.site.com/country/city/smthg
或 2:www.site.com/country/city/smthg/fct
或 3:www.site.com/country/city/smthg/fct/value
我想把网址改成这样:
1:www.site.com/index.php/smthg/index/country/city
2:www.site.com/index.php/smthg/fct/country/city
3 : www.site.com/index.php/smthg/fct/value/country/city
我正在使用 PHP Codeigniter 框架,
我试过了,但它不起作用:
Options -Indexes
RewriteEngine on
RewriteCond $1 !^(index\.php|assets/|robots\.txt)
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)$ index.php/$3/$1/$2 [L]
RewriteCond $1 !^(index\.php|assets/|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
【问题讨论】:
标签: php apache .htaccess codeigniter mod-rewrite