Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to redirect my '' to '' on apache2.Please help me ,how to do that.I am not getting how to use RewriteCond & RewriteRule.Please help.

share|improve this question

Turn on Apache rewrite:

sudo a2enmod rewrite

Edit your Apache config file...

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$ [R=301,L]

301 = permanent redirection

Restart Apache.

share|improve this answer

The easy way

Create a file named index.php with the following contents: <?php header('Location:'); ?>.
You don't need to use ModRewite if you find it too hard. ;)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.