mod_rewrite
module is installed and enabled. In order to enable mod_rewrite
you can type the following command in the terminal :sudo a2enmod rewrite
sudo a2enmod actions
.htaccess
and index.php
files are in the same public-accessible directory. The .htaccess
file should contain this code:RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
public/ directory
does not appear in the URL, you should add a second .htaccess
file above the public/ directory
with the following internal redirect rule:RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
.htaccess
files require URL rewriting..htaccess
rewrite rules can be used: To do this, the file /etc/apache2/apache2.conf
must be opened in an editor with root privileges.<Directory ...>
directive from AllowOveride
None to AllowOveride
All.<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo service apache2 restart
Debian/Ubuntu
variants. For all other Linux distributions, please consult the documentation of your specific Linux distribution to find out how to restart Apache.