1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question about .htaccess

Discussion in 'Server Configuration and Hosting' started by armic, Apr 10, 2016.

  1. armic

    armic Member


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

    I want to redirect all trafic from:




    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.

    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: Apr 11, 2016
  2. armic

    armic Member

    No answers, so I suppose the code is ok.


Share This Page