This at first might look like a duplicate question but I have done 10 hours of research on Internet and tried almost everything I've found but no luck with mod rewrite. Most of the post/tutorials on internet are old and they haven't updated their article since then.
I can see with phpinfo()
, that I have successfully loaded the mod_rewrite
module.
Next I know that I have to change AllowOverride None
to AllowOverride All
and few more changes on Apache's default.conf
file. Since I don't have a default.conf
file I did those changes on000-default.conf
, but mod_rewrite
doesn't work. I also changed the apache.conf
file, it still didn't work. I changed all files where I can see <Directory> </Directory>
but it didn't work.
My root directory is not /var/www
, in fact it is /var/www/html
.
Here is my 000-default.conf
file:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
How can I get mod_rewrite
to work?
Allow from
, I think you have to useRequire all granted
, etc. serverfault.com/a/549559