0

So I am trying to serve the same wordpress install to any cname on a domain. I'm running nginx and I think I have everything set up there correctly so it will answer to any cname, but wordpress keeps redirecting me back to the value of Site Address. Can I disable this check and redirect? So it will just serve wordpress regardless of the cname? I don't need the links changed or anything, just want it to not redirect.

1 Answer 1

0

You can define these in your wp-config.php file:

define('WP_HOME', 'http://'.$_SERVER["SERVER_NAME"]); // blog url
define('WP_SITEURL', 'http://'.$_SERVER["SERVER_NAME"]); // site url

Now, you'll need to make sure nginx is populating SERVER_NAME appropriately (I've had setups that were wrong and kept returning "_").

This will prevent wordpress form redirecting because it thinks it's already on the correct domain, and will also affect most generated local permalinks as well.

If that doesn't work (I only used it on one setup and it's only relevant to accessing the backend), you can add hooks to the 'option_siteurl' and 'option_home' filters to achieve the same affect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.