TheNytangel
TheNytangel

Reputation: 546

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

Upvotes: 3

Views: 10164

Answers (2)

anubhava
anubhava

Reputation: 784888

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

Upvotes: 1

Pettis
Pettis

Reputation: 130

You should have or specify Directory-block in your apache configurations. You can find AllowOverride documentation here: http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

And documentation about <Directory> is here: http://httpd.apache.org/docs/2.2/mod/core.html#directory

In short: specify where you would like to allow the settings to be overridden with <Directory /path/to/your/directory> and then use AllowOverride all in that directory block.

Upvotes: 0

Related Questions