.htaccess in subdirectory | Redirect to www from non-www

106 Views Asked by At

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?

0

There are 0 best solutions below