【发布时间】:2015-04-07 12:52:02
【问题描述】:
所以从共享主机转移到 VPS 后,我的 mod_rewrite 停止工作。 我在我的 apache 中打开了 mod_rewrite,但仍然没有。
我所有的项目文件都存储在/var/www/html/project和我的htaccess中:
RewriteEngine On
RewriteBase /html/project/
RewriteCond %{THE_REQUEST} \s/+(.*?)/{2,}([^\s]*)
RewriteRule ^ %1/%2 [R=302,L,NE]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.+?)/{2,}[?\s] [NC]
RewriteRule ^ /%1/ [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} system|application
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
但是 mod_rewrite 不想工作。我正在使用 digitalocean VPS。有任何想法吗?顺便说一句,VPS 安装了 apache 详细信息:Ubuntu LAMP on 14.04,我正在为我的项目使用 codeigniter
【问题讨论】:
-
您设置了
virtualhost文件吗?
标签: php apache .htaccess codeigniter mod-rewrite