To redirect all pages to another domain's homepage using nginx rewrite rules in PHP, you can add the following code to your nginx configuration file:
main.php99 chars6 lines
Replace the old_domain.com
with your current domain name and new_domain.com
with the new domain name to which you want to redirect all your website's pages.
You can save the changes and reload your nginx configuration to apply the new settings:
main.php26 chars2 lines
After making this change, all pages from the old domain will be redirected to the homepage of the new domain with a 301 permanent redirect.
gistlibby LogSnag