Hello everyone! I'm trying to force http://localhost/drupal to redirect to https://localhost/drupal. The installation folder of drupal is /wamp/www/drupal. For now I managed to have them both enabled. I followed the guide here http://developersdigest.blogspot.gr/2012/03/wamp-server-2-https-ssl-configuration.html I added DocumentRoot "C:/wamp/www/" Code (markup): to the httpd.conf file and added a virtual host to httpd-ssl.conf: <VirtualHost _default_:443> # General setup for the virtual host DocumentRoot "C:/wamp/www/" ServerName localhost:443 ServerAdmin admin@localhost # etc. Code (markup): With this setup, both http://localhost/drupal and https://localhost/drupal can be accessed. I tried to add several rules to httpd.conf, such as: RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/?() https://%{HTTP_HOST} [R=301,L] Code (markup): but they either lead to "access forbidden" blank page or to the frontpage of my website reporting that some link (eg. https://localhost/drupal/drupal) can't be found. Any ideas?
You can try with RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] Code (markup):
I changed the directories I use and managed to redirect from HTTP to HTTPS but I got access forbidden. I now have a /wamp/www directory with an index.php file with the following: <?php if($_SERVER["HTTPS"] != "on") { header("HTTP/1.1 301 Moved Permanently"); header('Location: https://test.com'); exit(); } ?> Code (markup): This redirects requests to another directory (/wamp/drupal) which contains the original drupal index.php file: define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); menu_execute_active_handler(); Code (markup): When I type http://test.com, it redirects to https://test.com/drupal with "You don't have permission to access /drupal/ on this server." Same when I type https://test.com, it gives "You don't have permission to access / on this server." I don't understand, access is forbidden by apache or drupal?