How to redirect alias or old domains to your primary domain



Have you ever been in one of these situations?
  1. Migrated from one domain to another (and preserve your search rankings)
  2. Created alternative domains but have one primary domain (which also helps with your search rankings)
You can use the following PHP script:
 

You want to replace oldsite.com and alternative-spelling.com with your alternative domains (delete one of them if you only have one). Then replace primary-domain.com with your primary domain. The script is used in a wodby deployment environment, but the most important part is:

# php snippet
header('HTTP/1.0 301 Moved Permanently');
header('Location: https://primary-domain.com');



Comments

Popular posts from this blog

Insights for Software Development Workflows from the Pacific Islands

Government of Tonga’s first mobile app nears completion

Bot Busters: Defending Your Site Against Bots