.htaccess does not work although enableoverride is enabled

I am using CodeIgniter and just installed the LAMP stack on an Ubuntu 10.10 cloud server.

Everything works fine, and I have the userdir Apache module turned on, so my home directory is in /home/myapp/public_html , and I access it by going to servername/~myapp .

Undoubtedly .htaccess rewrite does not work, this leads to the fact that the 404 message the file /home/myapp/public_html/index.php cannot be found - error 404.

Mod_rewrite enabled.

I know that you need to install the AllowOverride All directive - I installed it in /etc/apache2/sites-enabled/default , but rewriting does not work properly.

My .htaccess file simply contains:

 RewriteEngine on RewriteCond $1 !^(index.php|img|stylesheets|js|icons|robots\.txt|user_guide) RewriteRule ^(.*)$ index.php/$1 [L] 

And my /etc/apache2/sites-available/default looks like this:

 <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 

And finally, /etc/apache2/mods-enabled/userdir.conf looks like this:

 <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> 

I have been searching and playing for several hours, can anyone help?

+8
ubuntu apache codeigniter laravel
source share
1 answer

For what it's worth, I had a very similar problem with Ubuntu Server 11.10 and LAMP. I had to run a team

 sudo a2enmod rewrite 

which helped. Maybe this is the solution for you or other people coming here.

+14
source share

All Articles