Reputation: 360
I would like to turn SSL off for the /builder directory of my site. I have tried many different .htaccess configurations, but either I am putting them in the wrong order or they do not work.
Here is my current .htaccess:
Options +Indexes
RewriteEngine on
Redirect 301 /index.html /index.php
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.cdghost.xyz/$1 [R,L]
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html
ErrorDocument 504 /504.html
Thanks!
Upvotes: 1
Views: 71
Reputation: 41249
Try this
Options +Indexes
RewriteEngine on
Redirect 301 /index.html /index.php
RewriteCond %{SERVER_PORT} 80
RewriteRule ^((?!builder/).*)$ https://www.cdghost.xyz/$1 [R,L]
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html
ErrorDocument 504 /504.html
You can also use a RewriteCond to exclude /builder from the HTTPS rediretion :
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/builder
RewriteRule ^(.*)$ https://www.cdghost.xyz/$1 [R,L]
The RewriteCond checks to ensure that the Requested uri is not /builder/.. , if it's not /builder.., then the request is redirected to SSL.
Upvotes: 1