How-to Enable Apache 2 mod_rewrite on Ubuntu 16.04 Xenial LTS Easy Guide

October 25th, 2016 by thelinuxevangelist

Ubuntu 16.04 Xenial Apache Rewrite Setup



The Tutorial Shows You Step-by-Step How-to Enable the Apache2 Rewrite Module on Ubuntu 16.04 Xenial Xerus LTS 32/64bit 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

Enable Apache 2 mod_rewrite on Ubuntu 16.04 Xenial LTS - Featured
  1. Login into Server Shell

    Or Open a Command Line Terminal Window
    (Press “Enter” to Execute Commands)
    Ctr+Alt+t

    Enable Apache 2 mod_rewrite on Ubuntu 16.04 Xenial LTS - Open Terminal
  2. How-to Install LAMP Server on Ubuntu Linux

    LAMP Server Installation Ubuntu
  3. Enabling Apache2 Rewrite Module

    sudo su -c "a2enmod rewrite"
  4. How-to Create an Apache 2 Virtual Host on Ubuntu:

    Ubuntu Apache2 Virtual-Host Quick-Start
  5. To Setup an Apache2 Virtual Host for Rewrite

    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>
    

    Ctrl+Shift+v to Paste Content into nano
    Ctrl+x to Save and Exit from nano Editor :)

  6. How-to Install APC PHP Accellerator on Ubuntu:

    Install PHP APC for Ubuntu
  7. Restart Apache2 Web Server

    sudo service apache2 restart
Share on Tumblr

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


Comments are disabled