1

I'm trying to redirect

https://subdomain.example.com/mywebspace

to

https://www.subdomain.example.com/mywebspace

Unfortunately, I only have control over the contents in /mywebspace. I tried to place the following .htaccess file there (which is recognized by Apache, Basic Auth works) but the rewrite rule seems to have no effect:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Any hints?

trailbat
  • 11
  • 1
  • The rule looks fine. If it does not work for you then chances are that you are looking at a cached result, so please always test using a fresh anonymous browser window or clear your browser cache. If that is not the issue then chances are that you need to change the order of your rules (you indicate you have more content in that file than what you posted), so it would help if you posted the full configuration (anonymized where required). – arkascha Aug 05 '21 at 15:53

0 Answers0