Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you enable mod_rewrite on any OS?

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.

like image 508
John Avatar asked Jun 28 '10 09:06

John


People also ask

How do I enable rewrite in httpd?

htaccess file allows you to set up URL rewrite and redirection rules without changing Apache configuration file. To enable . htaccess file in Apache, look for <Directory /var/www/html> section and change the AllowOverride directive from None to All: . . .


1 Answers

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.

like image 190
Pekka Avatar answered Sep 25 '22 05:09

Pekka