arifix
arifix

Reputation: 750

Redirect domain/url by .htaccess

I have one Wordpress website that I want to redirect the entire domain and all pages associated with it to another website but after 2 seconds.

Maybe with .htaaccess or something.

Like- when anyone go to www.domainA.com he will redirect in- www.domainB.com after 2 second or instantly

when anyone go to www.domainA.com/apps he will redirect in- www.domainB.com/apps after 2 second or instantly

when anyone go to www.domainA.com/2013/05/avery-on-tortorella-bret-hart-apology-cm-punk-update/ he will redirect in- www.domainB.com/2013/05/avery-on-tortorella-bret-hart-apology-cm-punk-update/ after 2 second or instantly

Upvotes: 1

Views: 159

Answers (2)

anubhava
anubhava

Reputation: 785481

On www.domainA.com place this code in DocumentRoot/.htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com$ [NC]
RewriteRule ^ /temp.php?uri=%{REQUEST_URI} [L]

Then in temp.php page place this code to redirect to domainB after 2 seconds:

<head>
<meta http-equiv="refresh" content="2;URL=http://www.domainB.com<?php echo $_GET['uri'];?>">
</head>

Upvotes: 2

Pavel
Pavel

Reputation: 250

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301] 

Source: http://enarion.net/web/htaccess/migrate-domains/

Upvotes: 3

Related Questions