View Full Version : 301 redirect in .htaccess problem

03-17-2010, 12:12 AM
I am trying to create a 301 redirect code to have all webpages in my website point to the https website area, to access my SSL encryption:

My .HTACCESS file:

Options -Indexes
Redirect 301 / https://www.mydomain.com

Currently this website is running on a shared server, with a Linux operating system, with an apache server.

The code that I am using is not successfully traversing to the correct domain name, it mentioned something about an endless loop. Please help

Just as a side note, when I physically type in my domain name with the https in front it, then it works fine.

Thanks for any help in advance.

03-24-2010, 02:20 AM
My first guess would be that because you are essentially redirecting root "/" to root "/" over and over again is why you are getting the endless loop error.

When you access the page via http is finds the .htaccess and redirects the page to https but then it finds the .htaccess file and redirects again.

Well that's my best guess... but you say you can access it when you type in the address, which is weird.

one possible solution is to use different directories for each virtual server. so for your http virtual server use a dir like /var/www/html and for your ssl virtual server use something like /var/www/https

so that you put your website in https dir and your htaccess in the html dir...

something like that should fix your problem...

also, have a look at this thread http://codingforums.com/showthread.php?t=191665