Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to enable mod rewrite in xampp under ubuntu os?

I'm using xampp Linux under ubuntu and I want to use .htaccess in my local server the server keep giving me the404 error page I tried to modify the config file of apache httpd.conf but still te same problem httpd.conf - <Directory "/opt/lampp/apache2/htdocs"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> LoadModule rewrite_module modules/mod_rewrite.so - any help ?? thanks in advance

user-image
Question added by Omar Al khairat , php developer , Pandre Group
Date Posted: 2013/10/06
Mohammad Irfan
by Mohammad Irfan , Certified Magento Developer , Xcite.com

For some reason my install of XAMPP didn’t have mod_rewrite automatically enabled? Not really sure why  but basically below are the instructions on how to enable .htaccess mod_rewrite in xampp.

1. Go to the directory of installation <C:\xampp>\apache\conf

2. Open and edit httpd.conf in a text editor

3. Find the line which contains

  1. #LoadModule rewrite_module modules/mod_rewrite.so  

and (uncomment) change to

  1. LoadModule rewrite_module modules/mod_rewrite.so  

4. Find all occurrences of

  1. AllowOverride None  

and change to

  1. AllowOverride All  

I think it appears2 or3 times on the configuration file.

5. Restart xampp

That’s it you should be good to go.

Muhammad Anzar
by Muhammad Anzar , DevOps/DevSecOps Architect , Confidential

To enable it the rewrite module, run "apache2 enable module rewrite":

sudo a2enmod rewrite

You need to restart the webserver to apply the changes:

sudo service apache2 restart

If you plan on using mod_rewrite in .htaccess files, you also need to enable the use of .htaccessfiles by changing AllowOverride None to AllowOverride FileInfo. For the default website, edit /etc/apache2/sites-available/default:

<Directory /var/www/> Options Indexes FollowSymLinks MultiViews # changed from None to FileInfo AllowOverride FileInfo Order allow,deny allow from all </Directory>

After such a change, you need to restart Apache again.

More Questions Like This