Question about .htaccess

armic

Member
Hello!

I have a question about the use of .htaccess on my site.

I want to redirect all trafic from:

http://mydomain.com

to:

https://www.mydomain.com/community/

This code is working from 1 year ago, but Google say to i have to many "redirects", so i dont know if this is a correct code, or i can simplify it.

Code:
RewriteOptions inherit
RewriteEngine On

# Forzar "https"
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Forzar "www"
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) https://www.mydomain.com/$1 [R=301,L]

# Forzar redirección a "community"
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "https\:\/\/www\.mydomain\.com\/community" [R=301,L]

Thanks and regards
 
Last edited:
Top Bottom