Genetisis
Genetisis

Reputation: 65

redirect to https folder in .htaccess

I was trying to get an entire directory/section of my website to automatically re-direct to https (secure) using the .htaccess file, so I found a solution on here. It turns out it re-directs my ENTIRE site to HTTPS except for the homepage. I'd like it to only re-direct the /php/ folder and anything inside it.

Thanks in advance for any help!

Here is my code in .htaccess:

RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} php 
RewriteRule ^(.*)$ https://beanstalkwebsolutions.com/$1 [R,L]

Upvotes: 1

Views: 52

Answers (1)

anubhava
anubhava

Reputation: 786091

You can use this rule as your very first rule:

RewriteCond %{HTTPS} off
RewriteRule ^php(/|$) https://beanstalkwebsolutions.com%{REQUEST_URI} [NC,R,L]

Upvotes: 1

Related Questions