【发布时间】:2011-10-30 03:47:46
【问题描述】:
我正在使用 CodeIgniter,并且刚刚在 Ubuntu 10.10 云服务器上安装了 LAMP 堆栈。
一切正常,我启用了 Apache userdir 模块,因此我的主目录位于 /home/myapp/public_html,我通过转到 servername/~myapp 来访问它。
不幸的是,.htaccess rewrite 似乎不起作用 - 它会导致 404 提示无法找到 the file /home/myapp/public_html/index.php - 404 错误。
Mod_rewrite 已启用。
我知道您需要设置 AllowOverride All 指令 - 我在 /etc/apache2/sites-enabled/default 中设置了它 - 但重写似乎无法正常工作。
我的.htaccess 文件只包含:
RewriteEngine on
RewriteCond $1 !^(index.php|img|stylesheets|js|icons|robots\.txt|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]
我的/etc/apache2/sites-available/default 看起来像:
<VirtualHost *:80>
ServerAdmin dan@danmatthews.me
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
最后,/etc/apache2/mods-enabled/userdir.conf 看起来像:
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
我已经在谷歌上搜索和摆弄了几个小时,有人可以帮忙吗?
【问题讨论】:
标签: apache codeigniter ubuntu laravel