How to Enable Apache 2 mod_rewrite on Ubuntu 16.04

August 31, 2021 | By the+gnu+linux+evangelist | Filed in: Tutorial.

GNU/Linux Ubuntu 16.04 Apache Rewrite Setup Guide

You are Welcome! The Tutorial shows you Step-by-Step How to Enable the Apache2 Rewrite Module on Ubuntu 16.04 Xenial LTS GNU/Linux Server/Desktop.

The mod_rewrite Module uses a Rule-based Rewriting Engine, based on a PCRE Regular-Expression Parser, to Rewrite requested URLs On the Fly. By default, mod_rewrite maps a URL to a Filesystem Path. However, it can also be used to Redirect One URL to Another URL, or to invoke an Internal Proxy Fetch.

Apache mod_rewrite provides a flexible and Powerful way to manipulate URLs using an Unlimited Number of Rules. Each Rule can have an Unlimited Number of Attached Rule Conditions, to allow you to Rewrite URL based on Server Variables, Environment Variables, HTTP Headers, or Time Stamps.

How to Enable Apache 2 mod_rewrite on Ubuntu 16.04
  1. 1. Accessing Shell

    Login into Server Shell.
    Or Open a Command Line Terminal Window
    (Press “Enter” to Execute Commands)
    Ctrl+Alt+t

    Enable Apache 2 mod_rewrite on Ubuntu 16.04 Xenial LTS - Open Terminal

    How to Install LAMP Server on Ubuntu Linux.

    LAMP Server Installation Ubuntu
  2. 2. Enabling Apache2 Rewrite

    Now to Enable Apache2 Rewrite Module
    Simply play:

    sudo su -c "a2enmod rewrite"

    How to Create an Apache 2 Virtual Host on Ubuntu.

    GNU/Linux Apache2 Virtual-Host Quick Start
  3. 3. Setting up Domain

    Again to Setup an Apache2 Virtual Host for Rewrite
    Edit the Configuration File:

    sudo su -c "nano /etc/apache2/sites-available/[myDomainName].conf"

    Append inside the VirtualHost Section:

    <Directory /var/www/html/[mySite]>
    Options Indexes FollowSymLinks
    AllowOverride All
    </Directory>
    
  4. 4. Restarting Apache

    Finally, Restart Apache2 Web Server
    Simply with:

    sudo service apache2 restart


Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

QuickChic Theme • Powered by WordPress