Redirect site.com to www.site.com

Designer
Fra Canada
Medlem siden nov. 2018

Hi there, I have a .htaccess file on my home directory on the server which redirects https://airclix.com/ => https://www.airclix.com/

The rule is as follows:

301 --- https://airclix.com/ => https://www.airclix.com/

RewriteCond %{HTTP_HOST} ^airclix.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*)$ https://www.airclix.com/$1 [R=301,L]

When the url https://airclix.com is entered it is automatically redirected to https://www.airclix.com. However, when the url contains /webshop/ such as https://airclix.com/webshop/ it will not redirect to https://www.airclix.com/webshop/.  There is a also a .htaccess file in the "webshop" directory on the server which also has a rewrite rule as follows:

Redirect non-www to www

  #RewriteCond %{HTTP_HOST} !^www.
  #RewriteCond %{REQUEST_METHOD} !=POST
  #RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

I wondering what I should do with 2 .htaccess files. Should there be only one? Should I delete one? Or what can I do so https://airclix.com/webshop/ redirects to https://www.airclix.com/webshop/

Thanks, 
Miles

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

Uncomment the # before RewriteCond for it to have effect.

Designer
Fra Canada
Medlem siden nov. 2018

Thanks! That was easy.  Works now.
Miles

Denne tråden er stengt på grunn av lang inaktivitet. Det er ikke mulig å legge ut innlegg til det.
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.