Search code examples
php.htaccesscodeigniterubuntulamp

ubuntu htaccess not working


I am on a cloud server using ubuntu where i installed a lamp stack and added my server files etc...

but when i tried to access a page like 1.2.3.4/page it will return 404 page not found error...

I am using Codeigniter framework.

i tried editing site-available/default file and changing AllowOverride from No to All but it will then show a 500 server error

AllowOverride None

to

AllowOverride All

... any clues??

my htaccess file:

RewriteEngine On

#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

Solution

  • If you get 500 server error then the problem is not related to access restriction. check the web server log to find errors trace!

    500 server error means that your request has been processed (so no restriction issues) but errors happened.