I have a site in link and I've added an SSL certificate. I need a script via htaccess to redirect the whole site to link (301 redirect), however a single site specific page will need to be accessed via link Example:
link All site pages with https
link This page only without https
In this case, this page may even be accessed via link , but will also necessarily need to be accessed via link without redirection.
I tried this code, but it gives an error of over redirection. The intent would be to allow the mysite.com/api page to be accessible both via http and via https without redirection.
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{REQUEST_URI} !^/(api) [NC] #permite tanto acesso via https quanto http
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
This other code below worked perfectly for site 301 redirect, however I am not able to include the exception so that the / api page is also accessible without https:
# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^meusite\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL
# BEGIN WordPress