Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am getting a 404 not found when doing a mod rewrite in my htaccess file, accessing localhost

How can I get this to work, all references I found point me to edit a file in /etc/apache2/mods-enabled

for me there is no /etc/apache2 folder, where is apache installed then?

using xampp, http://www.apachefriends.org/en/xampp-linux.html

share|improve this question
    
Any help on this? –  Marchosius Sep 6 '12 at 7:24
add comment

2 Answers

Don't forget after setting in httpd.conf in this section:

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

you should enable mod_rewrite:

sudo a2enmod rewrite

and then restart apache:

sudo service apache2 restart

To ensure that, you can check from phpinfo in Configuration > apache2handler > Loaded Modules there must be written mod_rewrite and it means mod_rewrite is enabled. Hope it can help.

share|improve this answer
add comment

I'm not sure whether XAMPP actually has the sites-available/sites-enabled, mods-available/mods-enabled structure that the Ubuntu Apache packages use. But if those directories are there, I would expect them to be somewhere in /opt/lampp/etc, because the main config file httpd.conf is there (according to http://www.apachefriends.org/en/xampp-linux.html#385).

According to some (quite dated) blog entries on XAMPP, there might be a fitting LoadModule directive in that httpd.conf, something to the effect of

#LoadModule rewrite_module path/to/mod_rewrite.so

If this is still current, you need to remove the comment symbol (#) from that line. Additionally, you need to enable local overriding of the central settings (for example from a htaccess file or a vhost). So you need to look for

AllowOverride None

and change it to

AllowOverride All

That may appear in the httpd.conf more than once, you need to adjust every occurence. After the next restart of Apache mod_rewrite should be working.

At the end of the day, the mod-available/mod-enabled system is "just" a conventient way to manage configuration snippets like the LoadModule above, see for example /etc/apache2/mods-available/rewrite.load from the Ubuntu Apache packages).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.