If I understand correctly, I need to put something in httpd.config
to enable mod_rewrite. If this is true, what do I need to put in httpd.conf
or apache.conf
? Please be OS specific.
This question is related to
mod-rewrite
php
In my case, issue was occured even after all these configurations have done (@Pekka has mentioned changes in httpd.conf & .htaccess files). It was resolved only after I add
<Directory "project/path">
Order allow,deny
Allow from all
AllowOverride All
</Directory>
to virtual host configuration in vhost file
Edit on 29/09/2017 (For Apache 2.4 <) Refer this answer
<VirtualHost dropbox.local:80>
DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
ServerName dropbox.local
ErrorLog "logs/dropbox.local-error.log"
CustomLog "logs/dropbox.local-access.log" combined
<Directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
# AllowOverride All # Deprecated
# Order Allow,Deny # Deprecated
# Allow from all # Deprecated
# --New way of doing it
Require all granted
</Directory>
if it related to hosting site then ask to your hosting or if you want to enable it in local machine then check this youtube step by step tutorial related to enabling rewrite module in wamp apache
https://youtu.be/xIspOX9FuVU?t=1m43s
Wamp server icon -> Apache -> Apache Modules and check the rewrite module option
it should be checked but after that wamp require restart all services
No, you should not need to. mod_rewrite
is an Apache module. It has nothing to do with php.ini
.
Module rewrite_module is built-in in to the server most cases
Use .htaccess
Use the Mod Rewrite Generator at http://www.generateit.net/mod-rewrite/
Just a fyi for people enabling mod_rewrite on Debian with Apache2:
To check whether mod_rewrite is enabled:
Look in mods_enabled for a link to the module by running
ls /etc/apache2/mods-enabled | grep rewrite
If this outputs rewrite.load
then the module is enabled. (Note: your path to apache2 may not be /etc/, though it's likely to be.)
To enable mod_rewrite if it's not already:
Enable the module (essentially creates the link we were looking for above):
a2enmod rewrite
Reload all apache config files:
service apache2 restart
network solutions offers the advice to put a php.ini in the cgi-bin to enable mod_rewrite
In order to use mod_rewrite you can type the following command in the terminal:
$ su
$ passwd **********
# a2enmod rewrite
Restart apache2 after
# service apache2 restart
# /etc/init.d/apache2 restart
or
# service apache2 restart
Source: Stackoverflow.com