Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up HTTPS for Wordpress Authentication without success. Only SSL in wp-admin is sufficient.

Here is the conf file for the Virtual host:

<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias *.mydomain.com
UseCanonicalName    Off
VirtualDocumentRoot /srv/www/www.mydomain.com
    Options All
ServerAdmin mymail@mydomain.com

ErrorLog ${APACHE_LOG_DIR}/mydomain.com-error.log
    CustomLog ${APACHE_LOG_DIR}/mydomain.com-access.log combined

#Store Wordpress uploads in /srv/www/wp-uploads/$0
RewriteEngine On
RewriteRule ^/wp-uploads/(.*)$ /srv/www/wp-uploads/%{HTTP_HOST}/$1

<Location />
    #Only to keep compatibility with aliases to www.mydomain/$x
    Options Indexes SymLinksIfOwnerMatch

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        RewriteCond %{SERVER_PORT}  ^80$
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^wp-(admin|login)(.*) https://%{SERVER_NAME}/wp-$1$2 [L]

        RewriteCond %{SERVER_PORT}  ^80$
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        </IfModule>

</Location>

<Location /wp-uploads/>
    #Secure Wordpress uploads
    Options -Indexes
</Location>

</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.mydomain.com
    ServerAlias *.mydomain.com
    UseCanonicalName    Off
    VirtualDocumentRoot /srv/www/www.mydomain.com
    ServerAdmin mymail@mydomain.com

    ErrorLog ${APACHE_LOG_DIR}/ssl_www.mydomain.com-error.log
    CustomLog ${APACHE_LOG_DIR}/ssl_www.mydomain.com-access.log combined

    #Store Wordpress uploads in /srv/www/wp-uploads/$0
    RewriteEngine On
    RewriteRule ^/wp-uploads/(.*)$ /srv/www/wp-uploads/%{HTTP_HOST}/$1

    <Location />
            Options Indexes SymLinksIfOwnerMatch

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        RewriteCond %{SERVER_PORT}  !^80$
        RewriteRule !^wp-(admin|login)(.*) - [C]
        RewriteRule ^(.*)$ http://%{SERVER_NAME}/$1 [L]
            </IfModule>

    </Location>

    <Location /wp-uploads/>
            #Secure Wordpress uploads
            Options -Indexes
    </Location>

SSLEngine on

SSLCertificateFile    /etc/ssl/certs/mydomain.crt
SSLCertificateKeyFile /etc/ssl/private/mydomain.key

SSLCACertificatePath /etc/ssl/certs/

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
</Directory>

BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

</VirtualHost>
</IfModule>

What happens: when I try an https://www.mydomain.com I got redirected to http://www.mydomain.com/srv/www/www.mydomain.com/

The http://www.mydomain.com/wp-admin does not redirect to the https:// version as specified in the RewriteMod.

Thanks for any help.

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.