문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top