How to .htaccess

Basically what I wanted to do was,
to redirect the http://192.168.0.129/ to http://192.168.0.129/eulearn
So that the user have to type a little less.

htaccess

This is what I did to make that happen.

By default ubuntu ignores the contents of the .htaccess file (ref:https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles).
To make Ubuntu comply with the contents of .htaccess, edit the file
/etc/apache2/sites-available/000-default.conf

Add the following block and make sure it is properly indented.

<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

It should look like the following (Comments are truncated).

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>

Restart Apache

sudo service apache2 restart

Make sure the .htaccess file could be read by everyone.

sudo chmod 644 /var/www/html/.htaccess

Edit the .htaccess file

sudo nano /var/www/html/.htaccess

and add the following lines:

RewriteEngine on
RewriteRule ^index.html$ /eulearn [NC]

Save and exit.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s