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

here is my /etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
ServerAdmin admin@whereever.com
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://mysite.com
DocumentRoot /var/www/http
<Directory />
    Options None
    AllowOverride None

<Directory /var/www/http>
    Options -Indexes -FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from ::1/128


Not sure how to fix this. Any thoughts?

share|improve this question
What error are you getting? What is your VirtualHost block for port 443? –  DerfK Nov 18 '12 at 4:31

2 Answers 2

You should be able to connect to 'https://localhost/phpmyadmin'.

Alternatively you can modify your RewriteRule to include a back reference for the matched string.

RewriteRule /(.*) https://mysite.com/$1 [R=301] 
share|improve this answer

I'd use the following RewriteRules to accomplish redirect. This will preserve the requested URL and just change the protocol to https://

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R] 
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.