My site is hosted by a university that runs all external traffic through an alias. The actual URL of the server is accessible only on campus. Right now I have the site address set to the alias and the wordpress address is the real server (to make that work I had to make several manual changes to the theme so that the css ran through the alias). However, obviously I can only log in through the wordpress address, which means logins are only possible on campus. If I change the wordpress address to the alias I get a redirect loop. I assume this is a cookie problem, but I can’t figure out how to fix it. Thanks.
Update: Explaining further:
Sorry–it is complicated. The server address is something like https://server.faculty.school.edu, but that address is only accessible internally. https://alias.school.edu has its DNS entry set to point to https://server.faculty.school.edu, enabling external traffic. Right now I have the WordPress address as https://server.faculty.school.edu, and the Site address as https://alias.school.edu. This enables the site to be viewed off campus, but logins off campus are impossible. So I want to change the WordPress address to https://server.faculty.school.edu, but if I do so I get a redirect loop when I try to log in (and I have to change it back using phpmyadmin). I have tried setting both addresses directly in wp-config.php, but that had the same result. Any thoughts? Thanks.
1 Answer
You can make wordpress have a dynamic url which will allow it to take any domain pointed to it. Put the following code towards the bottom of your “wp-config.php” file.
// Make WordPress have a dynamic url
define('WP_SITEURL', 'http://'.$_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://'.$_SERVER['HTTP_HOST']);