Reputation: 125
I've a WordPress site which needs to be accessible via both public domain name and IP address as well. It needs to behave exactly the same when accessed from any.
I tried adding IP as server alias bit that seem to work for home page only.
ServerName site.local
ServerAlias www.site.local
ServerAlias 127.0.0.10
When traversing pages, it redirects to server name instead of server alias I added.
Since WP stores site url and home url in database itself, I think it priorities it.
Is there any way I can make this thing happen.
Upvotes: 0
Views: 1763
Reputation: 2972
You could set WP_HOME
and WP_SITEURL
constants in wp-config.php based on what $_SERVER["HTTP_HOST"]
is.
That will take care of a lot, but if you have hardcoded links to http://example.com/mypage/, those will not be rewritten to http://10.10.10.10/ when accessed via IP. If you require that, you'll probably have to use an output handler that changes the output after it has been generated.
Upvotes: 1