How to redirect alias or old domains to your primary domain
Have you ever been in one of these situations?
- Migrated from one domain to another (and preserve your search rankings)
- 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
Post a Comment