I have the following simple code in my .htaccess file in order to forward my domain to the HTTPS version of the website:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://example.com/$1 [R,L]

My website is in a folder and the .htaccess file is in the root of my hosting account. When I enter http://example.com to test it it forwards me to https://example.com/folder/ which contains the website. My domain is pointed to that folder in my hosting account in order to serve we website. The HTTPS fowarding tells it to go to that URL but that url is asking the browser to go to the folder?!

If I try testing using HTTPS it works just fine. How do I forward the domain to ignore the folder name where the website is housed?

1 Answer 1


Never mind. I had to clear my cache and decided to place the .htaccess file in the folder for the website that I have the SSL for.

Problem resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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