Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey, I am developing a CMS/Framework for my clients and have just implemented a PHP script that detects if the currently loaded "application" requires HTTPS and redirects to the HTTPS equivalent if so.

At the same time I am also using mod_rewrite to implement friendly URLs which works great. However, when the script goes to HTTPS the mod_rewrite no longer seems to work and I get a standard Apache "access forbidden" message.

This is on a localhost development server (using XAMPP) with no SSL certificate installed (there would be on a live server). To be clear, I am NOT trying to force HTTPS via the mod_rewrite (this is what 90% of search results seem to be for), just want to get my friendly URLs working on it.

Edit: It also happens when accessing the "root" address (https://localhost/cms/) where it would default to the index page.

Here is my .htaccess:

# Protect files.
<FilesMatch "(\.(xml|html|cache))$">
  Order allow,deny

# Disable directory listings.
Options -Indexes

# Follow symbolic links.
Options +FollowSymLinks

# Error document.
ErrorDocument 404 /index.php

# Rewrite URLs.
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*)$ index.php?request=$1 [L,QSA]

Any help would be much appreciated. Thanks :)

share|improve this question
Are the different ports handled by different config files? – Nerdling Jun 28 '10 at 10:54
Yes, that seems to have been the problem. Just came across someone saying they had to configure an httpd-ssl.conf file as it has a seperate DocumentRoot setting. Changed it to the correct DocumentRoot and now it all works. :) – Fourjays Jun 28 '10 at 10:58

Seems the problem was that there is a second, seperate DocumentRoot configuration for SSL on Apache/XAMPP. Fixed it by setting the DocumentRoot value in "httpd-ssl.conf" to the same as the one in my "httpd.conf" file. Now everything works great!

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.