Domanda

So, just a question on if this is possible.

I am using a 301 redirect from the old site to the new one, but those can be a bit jarring for users. SO, I had a though. Can I get users to see a message if they are forwarded from an older domain name? Like so:

1) They visit the new site, they see just the site. 2) They visit the old site, they get forwarded to the new site AND on the new site they get a popup explaining the old site is dead and this is the new one.

Is that possible??

Thanks in advance!

È stato utile?

Soluzione

You can actually do your 301 rule like this:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^ http://newdomain.com%{REQUEST_URI}?redir=1 [R=301,L,NE,QSA]

Now on newdomain.com page just check for ?redir=1 in URLs, if it is found then show appropriate popup message to user.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top