How To Enable and Configure Apaches Mod Rewrite Module

In order to be able to use RewriteEngine to rewrite URLs you will need to have mod_rewrite installed for Apache. To Install it enter the line of code below into terminal. The following line will install for CentOS. This command may differ for different Linux distributions.

yum provides \*mod_rewrite\*

Once installed you will need to open your httpd.conf file which should be located in /etc/httpd/conf/httpd.conf. Scroll down and make sure the mod_rewrite module is uncommented. Note: There will be a # in front of the line if it is commented out. Remove the # if it is there.

LoadModule rewrite_module modules/mod_rewrite.so

The final step is to allow URLs to be rewritten in your websites directory. E.G. If your site is located in /var/www/html you will need to look for a DocumentRoot block that contains the path. This was listed twice for me so make sure you check to see there isnt a DocumentRoot entry for your path more than once.

DocumentRoot "/var/www/html"

<Directory />
Options FollowSymLinks
AllowOverride none
</Directory>

You need to change this to

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

Now restart apache and you should be able to add rewrite rules to your .htaccess file.

service httpd restart

Related Articles

Related Questions

Thinking of Switching from Windows to Arch for Gaming – Need Some Advice!

I'm considering making the jump from Windows to Arch Linux, primarily because I use my PC for gaming. I have a few questions: 1. How...

Help with Laravel Setup Error

I'm trying to set up Laravel following a tutorial on YouTube, but I'm hitting a snag. When I run the command "laravel new firstwebsite",...

How do I roll out BitLocker with a generic PIN for all devices?

Hey everyone, I'm in the middle of rolling out BitLocker to around 300-400 devices at my company. I've managed to set some configurations like...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Tools

Online Hash Generator – String to Hash Converter

Need to quickly generate a hash from a string? Whether you're verifying file integrity, securing data, or just experimenting with cryptographic tools, this simple...

Convert CSV To HTML Table

Need to quickly turn CSV data into an HTML table? Whether you're copying data from Excel, Google Sheets, or another spreadsheet, this tool makes...

Student Group Randomizer

Creating fair and balanced groups in the classroom can be time-consuming — especially when you're trying to avoid repetition, manage different skill levels, or...

Random Group Generator

Need to split a list of people, items, or ideas into random groups? Our free Random Group Generator makes it quick and easy. Whether...

Flip Text Upside Down – Free Online Tool

Ever wanted to flip your text upside down just for fun or to grab someone’s attention in a creative way? This free online Upside...

Raffle Ticket Generator

If you're running a fundraiser, charity draw, or local event and need raffle tickets fast, this free online tool lets you generate and print...

Latest Posts

Latest Questions