I have a website with a shared hoster. There are a few things that I have there, like main site, Piwik, a blog and other standalone things.
Right now I have the following structure:
~/subs/www
gets served asexample.org
andwww.example.org
~/subs/blog
gets served asblog.example.org
~/subs/app/piwik
gets served asapp.example.org/piwik
~/subs/app/foo
gets served asapp.example.org/foo
This is a all nice, I have separate cookies for the different applications. However, I would need a wildcard TLS certificate in order to get everything encrypted. Especially since Piwik is included in the main page, it must also be served over a secure connection. The provider wants 10 EUR/month for the wildcard certificate.
Now they offer one free certificate which I have issued for example.org
and getting www.example.org
for free. In consequence I would have to serve everything from example.org
in order to get consistent TLS.
From a user standpoint, I would like to have the following URLs:
/
is the main site/blog
is the blog/app/piwik
points to the Piwik installation/app/foo
points to some other stand-alone application
I do like the directory structure on the server, especially since I can just rsync --delete
into the ~/subs/www
directory and automatically prune files that I have deleted on disk. If I would upload the files such that they get served correctly, I would not do this any more.
So I would like to do this:
~/subs/www
is served atexample.org/
~/subs/blog
is served atexample.org/blog
~/subs/app/piwik
is served atexample.org/app/piwik
From this question I gathered that the following .htaccess
should do the trick:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/subs/
RewriteRule ^blog(.*) /subs/blog$1 [L]
However, when I request example.com/blog
in my browser, I get redirected to example.com/subs/blog
. I don't want to redirect, I want to do this mapping in the background such that the visitor will never see the URL fragment /subs/
.
The shared hoster is Domain Factory, I can put in .htaccess
files but I cannot alter any configuration files that need root
access to the system.
How can achieve this?
~/subs/www
for the main site and the others are configured as separate virtual hosts.Alias
directives, but they can only be used in the main conf files, not in.htaccess
..htaccess
.