Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web server not reading .htaccess file

I have Ubuntu 12.10 with apache2 installed, and my .htaccess file is not working. I have it set up to be able to not have .php file extensions in the links, so it looks like www.website.com/login instead of /login.php, but it says that the URL "/login" is not found on the server. I have read this page and it says something about "AllowOverride All" but I don't know where that is, or if I need to add it, where I would add it.

EDIT: I have found this link and have found what it says, but it says that I have an Internal Server Error on any page I go to. I have changed the to

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

but it says Internal Server Error

EDIT #2: In the error log, it says

/var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

EDIT #3: Found the answer here: .htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

like image 596
TheNytangel Avatar asked Mar 25 '26 06:03

TheNytangel


1 Answers

  • Make sure you have enabled mod_rewrite in your .htaccess.

Also make sure you these lines at the top of your .htaccess:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

i.e. turn the MultiViews options off.

Also see this Q&A for a similar problem and my answer.

like image 166
anubhava Avatar answered Mar 28 '26 03:03

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!