Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Enable mod_rewrite on Apache
#1
Hello, this tutorial will teach you how to enable mod_rewrite for Friendly URLS to work.

This tutorial uses SSH, and preferable as root.

Step 1 - Add the rewrite.load to /etc/apache2/mods-enabled/

To do so, enter the following command

ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/

Step 2 - Edit Apache Configuration for virtualhosting.

To do so, you must edit this file. Enter the following command.

pico /etc/apache2/sites-enabled/000-default

Now make adjustments wherever you see DocumentRoot pointing to your www or public_html directory and change AlloweOverride to all.

For example, this how it looks on mine. (Bold = edited)

<VirtualHost *>
        ServerAdmin [email protected]

        DocumentRoot /home/**/aaspforum.com/[i]public_html[/i]
        <Directory />
                Options FollowSymLinks
                AllowOverride [b]all[/b]
        </Directory>
        <Directory /home/**/aaspforum.com/[i]public_html/[/i]>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride [b]all[/b]
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
#                RedirectMatch ^/$ /apache2-default/
        </Directory>

Those were the sections in that file that had the directory pointing to public_html. It might be www for you.

Save the file.

Step 3 - Restart Apache

/etc/init.d/apache2 restart

And that's it! Hopefully you won't run into problems. Enjoy
Reply
#2
Thank you...
Reply
#3
Correct me if I am wrong, this is for debian/unbuntu?
Reply
#4
It is for all versions of linux running Apache, I think atleast.
Your friendly neighbourhood lurker.
Reply
#5
It is working fine, Exactly, Thankyou dude
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)