Redirect apache to your wordpress install

We can redirect our ‘localhost’ site to ‘localhost/blog’ on the server using the Apache Redirect Directive.

First, create/edit the .htaccess file in your web root directory. This is usually “/var/www/html”.

sudo pico /var/www/html/.htaccess

Add this line, replacing ‘example’ with your domain name and ‘blog’ with the directory you want to redirect to:
Redirect / http://example.com/blog

Now, all you need to do is restart apache2:
sudo /etc/init.d/apache2 restart

Leave a comment

Your email address will not be published. Required fields are marked *