Answer the question
In order to leave comments, you need to log in
Why doesn't RewriteRule work on localhost?
When developing a site, I usually use .htaccess with Joomla, it works great on hostings. On localhost did not want to work. "Googled" another .htaccess, it also works on hosting, but it doesn't work for me either:
<Directory "/var/www/html/">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</Directory>
Not Found
The requested URL was not found on this server.
Apache/2.4.29 (Ubuntu) Server at localhost Port 80
Answer the question
In order to leave comments, you need to log in
httpd.apache.org/docs/2.4/mod/core.html#directory
The directive <Directory>
is only available in server config, virtual host.
If you push it into .htaccess, then instead of the site there will be an error page 500, and an entry in error.log. <Directory not allowed here
If the site opens with such .htaccess, then .htaccess processing is disabled in the AllowOverride settings and these files are simply ignored.
On Ubuntu, VirtualHost configuration files are located in /etc/apache2/sites-available/.
To enable .htaccess, replace AllowOverride None
with You AllowOverride All
may also need to enable mod_rewrite
sudo a2enmod rewrite
And don't forget to restart apache
sudo service apache2 restart
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question