启用mod_rewrite
vhosts.conf设置为允许
<Directory "/home/chinatow/public_html">
AllowOverride All
</Directory>
.htaccess(应该没问题)
#--- Uncomment this line for production or testing server
#SetEnv CI_ENV production
#--- Allow remote API access; change "*" to "your-domain.com" for better security
#--- Note: require Headers mod enabled (sudo a2enmod headers)
#Header add Access-Control-Allow-Origin "*"
#--- URL rewrite
#--- Note: require Headers mod enabled (sudo a2enmod rewrite)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我认为一切都运作良好,但结束了.htaccess无法正常工作。
答案 0 :(得分:0)
您可以使用此 .htaccess 文件。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
答案 1 :(得分:0)
试试这个
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
答案 2 :(得分:0)
结果是htaccess错误。我的网址是
XX.XX.XX.XX /〜帐户
htaccess应该是
RewriteEngine On
RewriteBase /~account/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
谢谢!
答案 3 :(得分:0)
这可能会对你有帮助。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]