Reputation: 4944
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.
Upvotes: 52
Views: 210391
Reputation: 3180
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>
Upvotes: 14
Reputation: 1
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
Upvotes: -3
Reputation: 7100
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
Upvotes: 1
Reputation: 1201
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
Upvotes: 63
Reputation: 1
network solutions offers the advice to put a php.ini in the cgi-bin to enable mod_rewrite
Upvotes: 0
Reputation: 18665
No, you should not need to. mod_rewrite
is an Apache module. It has nothing to do with php.ini
.
Upvotes: 2
Reputation: 11
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/
Upvotes: 0
Reputation: 449525
Nope, mod_rewrite
is an Apache module and has nothing to do with PHP.
To activate the module, the following line in httpd.conf
needs to be active:
LoadModule rewrite_module modules/mod_rewrite.so
to see whether it is already active, try putting a .htaccess
file into a web directory containing the line
RewriteEngine on
if this works without throwing a 500 internal server error, and the .htaccess
file gets parsed, URL rewriting works.
Upvotes: 68