Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to redirect my 'http://www.mysite.com' to 'http://www.newdomain.com/Login.html' on apache2.Please help me ,how to do that.I am not getting how to use RewriteCond & RewriteRule.Please help.

share|improve this question

2 Answers 2

Turn on Apache rewrite:

sudo a2enmod rewrite

Edit your Apache config file...

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/Login.html [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: http://www.newdomain.com/Login.html'); ?>.
You don't need to use ModRewite if you find it too hard. ;)

share|improve this answer

Your Answer

 
discard

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.