Last active
February 9, 2019 08:16
-
-
Save xyznaveen/a44c88a3fe71f5ceb82c2b497002a379 to your computer and use it in GitHub Desktop.
Gist to change the default root of apache2 and enable mod_rewrite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------- | |
ADDING CUSTOM PATH AS ROOT DIRECTORY FOR APACHE | |
------------------------------------------------- | |
1. Go to apahce's configuration directory | |
cd /etc/apache2/sites-available | |
2. Open the configuration file with your favorite editor. | |
sudo gedit 000-default.conf # my choice because, why not ? | |
sudo nano 000-default.conf | |
3. Change the following line, you can get it by right clicking and selecting properties. | |
DocumentRoot /path/to/your/project | |
4. Restart the apache server | |
sudo service apache2 restart | |
---------------------- | |
ENABLING MOD_REWRITE | |
---------------------- | |
1. Chnge the directory to the where the executable is and enable a2enmod. | |
cd /etc/apache2/mods-enabled/ && sudo a2enmod rewrite | |
2. Change the <Directory></Directory> values. Note the '/var/www/' is your path change it to your own. | |
<Directory /> | |
Options Indexes FollowSymLinks | |
AllowOverride None | |
Require all granted | |
</Directory> | |
3. Restart the server. | |
sudo /etc/init.d/apache2 restart | |
KUDOS! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment