[wp-trac] [WordPress Trac] #53998: Use network_home_url() instead of $_SERVER['HTTP_HOST'] for added safety.

WordPress Trac noreply at wordpress.org
Mon Jan 3 08:25:18 UTC 2022


#53998: Use network_home_url() instead of $_SERVER['HTTP_HOST'] for added safety.
------------------------------------+------------------------------
 Reporter:  wp_kc                   |       Owner:  (none)
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  General                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+------------------------------

Comment (by ootwch):

 Added a PR for this (see comment to PR)

 Note: .htaccess still has to be modified behind a reverse proxy, otherwise
 mod_dir will try to handle the directories and insist on messing up the
 URL's.


 {{{
 # add a trailing slash to directories, so that mod_dir does not produce an
 invalid redirect
 # https://stackoverflow.com/questions/32130330/htaccess-rewriterule-
 redirects-to-wrong-url
 RewriteCond %{DOCUMENT_ROOT}/\$1 -d
 RewriteRule ^(.*?[^/])\$ %{HTTP:x-forwarded-prefix}%{REQUEST_URI}/
 [L,R=302]
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53998#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list