Whenever I save a setting in wp-admin, I get redirected to /af-wiki/af-wiki/wp-admin/options-general.php. Nonetheless, my alterations are stored properly.

Saving pages, browsing, changing themes, .. all of this is working. Just changing the settings redirects me to some strange site. I don't even understand where it gets constructed.

I had a lot of issues, trying to get the SSL proxy working. I finally managed to overcome almost all of my problems by configuring wp-config.php, vhosts and webserver first, and reinstalling/repopulating the DB from the SSL address https://wiki.af.example.com.

The config
The website is run on an apache2 server at http://internal-ip/af-wiki. To connect it to the internet there is a reverse proxy with SSL (also apache2) that is reachable at wiki.af.example.com. I simply do not understand where this af-wiki/af-wiki comes from.

There are three parts to the config: wp-config, vhost on webserver and vhost on proxy.


define('WP_DEBUG', false);

# I reinstalled the database when the wp-config was already present. 
# This allowed me to stop using WP_HOME, which used to mess up my home page.


define('FORCE_SSL_ADMIN', true);
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)

Web server vhost

Well.. there isn't one. There is just the 000-default from apache, and all sites are in a sub-folder. For completeness the 000-default:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted

Reverse Proxy vhost

<IfModule mod_ssl.c>
  <VirtualHost *:443>
    ServerName wiki.af.example.com
    ProxyPreserveHost Off
    ProxyPass / http://internal-IP/af-wiki/
    ProxyPassReverse / http://internal-IP/af-wiki/
    RequestHeader set X-Forwarded-Proto "https"
    SSLCertificateFile /etc/letsencrypt/live/wiki.af.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/wiki.af.example.com/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
  • I added a rewrite rule to the reverse proxy host: RewriteRule ^/?af-wiki/(.*)$ /$1 [R] . Although this works, it's a very shitty solution. This should be handled by WP – Frank Vermeulen Mar 20 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.