因此,在从共享主机迁移到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在14.04,我正在为我的项目使用codeigniter
发布于 2015-04-08 01:46:44
因此,过了一段时间后,我发现我必须更改/etc/apache2/apache2.conf以及其他文件。我已启用多视图http://prntscr.com/6qt89p
发布于 2015-04-07 20:59:02
你是不是在没有RewriteBase的情况下尝试.htaccess。将AllowOverride FileInfo更改为AllowOverride all in file /etc/apache2/sites-enabled/000-default
Options -Indexes +MultiViews +FollowSymLinks
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]https://stackoverflow.com/questions/29492102
复制相似问题