WordPress Themes Development Question: Download WordPress Theme Development PDF

Tell me how can I get WordPress working when I’m behind a reverse proxy?

Tweet Share WhatsApp

Answer:

In some setups, it’s necessary to use something other than the HTTP_HOST header to generate URLs. Reverse proxies take the original request and send it to one of a group of servers. To do so, it overwrites the HTTP_HOST with the internal server’s domain. When that domain is not publicly accessible, at best your images might not load correctly, at worst, you’ll be stuck in a redirect loop. To fix this, figure out which header has the right domain name and add a line to your wp-config.phpfile that overwrites HTTP_HOST with the correct hostname.
If you need to use SERVER_NAME, add this line to wp-config.php:
$_SERVER[‘HTTP_HOST’] = $_SERVER[‘SERVER_NAME’];
If you need to use HTTP_X_FORWARDED_HOST, add this line to wp-config.php:
$_SERVER[‘HTTP_HOST’] = $_SERVER[‘HTTP_X_FORWARDED_HOST’];

Download WordPress Theme Development PDF Read All 109 WordPress Theme Development Questions
Previous QuestionNext Question
Explain me how to add option for open menu item in new tab?Tell me why you use a static front page in wordpress?