I've tried to setup my wordpress using 1 domain name and 1 ip address, after this, all the css is missing, but the site still can be accessible using both domain and ip address.
Then I tried to revert back to either ip only or domain only, the css all became normal again
So is there any fix to get the css back to normal with 2 address set in wp_option?
Webserver : Nginx (I have tested for days, I can safe to say there is no problem with the webserver)
I've tried to setup my wordpress using 1 domain name and 1 ip address, after this, all the css is missing, but the site still can be accessible using both domain and ip address.
Then I tried to revert back to either ip only or domain only, the css all became normal again
So is there any fix to get the css back to normal with 2 address set in wp_option?
Webserver : Nginx (I have tested for days, I can safe to say there is no problem with the webserver)
Share Improve this question edited May 18, 2020 at 16:49 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked May 18, 2020 at 16:37 iwanttosleepiwanttosleep 13 bronze badges 4- Hi Fuxia. I don't think siteurl and home accept comma delimited values. Could you clarify why are your doing this? Perhaps others can recommend another way to achieve your goal. – Ted Stresen-Reuter Commented May 18, 2020 at 16:53
- @TedStresen-Reuter I am using wireguard VPN to secure my wordpress, instead of whitelist the VPN public ip on "wp-login.php", I think to allow the "internal ip" to access the "wp-login.php" is better so I don't need to route all my traffic to the VPN. Do you have any idea to make "siteurl" and "home" to accept multiple address? – iwanttosleep Commented May 18, 2020 at 17:29
- @iwanttosleep you shouldn't be changing WP itself to get around the limitations of your VPN. Just make WP Admin/Login reject requests unless they come from a particular IP aka the exit node of your VPN. That can be done at the Apache/Nginx level. There's no reason that the URL of the site would ever change to be the IP – Tom J Nowell ♦ Commented May 18, 2020 at 18:21
- Although I agree you shouldn't be changing WP to get around a limitation of your connection method (it's not necessary, I don't think), you could try adding login in wp-settings.php that set's WP_HOME and WP_SITEURL thus achieving your goal. – Ted Stresen-Reuter Commented May 19, 2020 at 8:27
2 Answers
Reset to default 0After testing for hours, finally get it done.
Here the solution:
In database wp_options
change the value for siteurl
and home
from your wordpress url
to /path/to/wordpress
Wordpress URL
Path To Wordpress
Then add these code in the bottom of wp-config.php
define('WP_HOME', 'http://' .$_SERVER['HTTP_HOST'].'/');
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/' );
Now you can use Domain and IP together to access your wordpress. Of course you need to setup your webserver to listen to both
*It is not my VPN limitation though, just because I can and I think this is more cool.
You can't put multiple addresses in those options fields, that's not how it works. Anything other than a single address will result in a broken site.
Out of the box, on a singular site, WP will serve pages to any address, the issue you face is that the URLs in the page source will all contain absolute URLs rather than relative URLs.
Instead, consider focusing on your actual problem that you mentioned in your comment, rather than how to implement a speculative solution, that of configuring your VPN