Running wordpress Ubuntu, installed via Serverpilot (nginx reverse proxy apache)
I have 2 domains, domain1.com NS are with DO, domain2.com NS with another host, but pointing to DO servers. I need domain1.com to point to domain2,
I added both domains via serverpilot, so both domain1 & domain2 show the same exact website, and each domain can be used to access the site.
I think I may have set this up a little wonky, but I can’t figure out how to get domain1 to show domain 2 site.
Thanks in advance, and if I missed anything or my explanation doesn’t make any sense let me now.
Thank yoU!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Ok!
So if anyone else is having this problem it can be fixed real easy via editing the wp-config.php file
I did what @jarland had said, but it was causing all sorts of redirects. Serverpilot creates SP_REQUEST_URL for site url and home. So all I had to do was change that to the domain I wanted the website to show, domain1.com, and now both domain2.com and domain1.com both show domain1.com -
Hope it helps someone else!
Hey friend,
Given that your setup is Apache reverse proxied by Nginx, this may actually be quite easy. At least, I’m hoping it is. Try creating a “.htaccess” file in the document root for domain1 with this in it:
RewriteEngine ON
RewriteRule ^(.*)$ https://domain2.tld/$1 [R=301,L]
Replace “domain2.tld” with your domain, and adjust the https if you do not use SSL. If you already have a .htaccess there, rename it to something like “.htaccess.old” to keep it but get it out of the way.
Jarland
Thank you Jarland, so I think this is working, the problem I came across is that I am currently running wordpress, so there are some htaccess items listed already. I tried to add this to the current htaccess, it gave me an error with too many redirects. Then I created just this file and I think it worked, but I fear I may be missing some of the needed listed items in the htaccess file below? I tried to arrange some of them, but my knowledge on what the wordpress htaccess file is doing is a bit limited.
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.