Wordpress behind reverse proxy admin issues -
basically title says got wp behind reverse proxy. let's say, domain , , wordpress ****/blog here wp-config.php edits allow work way:
define('.admin_cookie_path.', '/blog'); define('.cookie_domain.', 'www.***.com'); define('.cookiepath.', '/blog'); define('.sitecookiepath.', '.'); if(isset($_server['http_x_forwarded_for'])) { $list = explode(',',$_server['http_x_forwarded_for']); $_server['remote_addr'] = $list[0]; } define('domain_current_site', 'https://www.***.com/blog'); define('wp_home','https://www.***.com/blog'); define('wp_siteurl','https://www.***.com/blog'); $_server['remote_addr'] = 'https://www.***.com/blog'; $_server['http_host'] = 'www.***.com/blog'; $_server[ 'server_addr' ] = 'www.***.com/blog'; define('force_ssl_admin', true); define('force_ssl_login', true); if ($_server['http_x_forwarded_proto'] == 'https') $_server['https']='on'; $_server['request_uri'] = str_replace("https://www.***.com/wp-admin", "https://www.***.com/blog/wp-admin", $_server['request_uri']);
now, works perfectly, when m in places in admin panel, lets comments, if submit forms, wp goes */wp-admin instead of */blog/wp-admin , crashes 404.
update
tried vhost approach, added httpd.conf
listen 80 <virtualhost *:80> documentroot /var/www/wp-admin servername https://***/blog/wp-admin # other directives here </virtualhost>
but strangely got redirect loop whenever go /blog after
how fix this?
$_server['request_uri'] not contains full url, should replace /wp-admin/. given example:
$_server['request_uri'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_server['request_uri']);
Comments
Post a Comment