Programming > PHP

How to Enable mod_rewrite

(1/1)

chloe vevrier:
Hello Board,

I did not find any suitable board for Apache discussions. I think PHP is more related to Apache so I am putting my question in this board.

I have installed Apache and trying to execute PLD(PHP Link Directory) Script on the server which has built in Static URL support but apache is not doing rewrite stuff. How can I fix this?

Haider:
Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)
Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line). Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

To verify Create a .htaccess file (a text file named .htaccess) with the following code in it


--- Code: ---Options +FollowSymLinks
RewriteEngine On
--- End code ---

Save the file to a subdirectory of your main site something like this /rewrite-testfolder/.htaccess
Now attempt to browse to the subdirectory (http://localhost/rewrite-testfolder/). One of two things could happen

- No errors Congrats mod_rewrite engine is now enabled.  ;D

- 500, Internal Server Error If you get this message then mod_rewrite was not installed/enabled on your computer.   :'(

I hope this will help




webpro:
Open terminal and typin a2enmod rewrite , It will enable your mod_rewrite module for Apache. Then go to /etc/apache2/sites-available and edit default file. (For this you must have writable permissions to this file and sites-available folder.) Take clean URL test again and this time it will be passed.

Navigation

[0] Message Index

Go to full version