: Internal redirection: Serve “/site” as “/” and “/sub/blog” as “/blog” I have a website with a shared hoster. There are a few things that I have there, like main site, Piwik, a
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 as example.org and example.org ~/subs/blog gets served as blog.example.org
~/subs/app/piwik gets served as app.example.org/piwik
~/subs/app/foo gets served as app.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 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 at example.org/
~/subs/blog is served at example.org/blog
~/subs/app/piwik is served at example.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 [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?
More posts by @Kevin317
1 Comments
Sorted by latest first Latest Oldest Best
From what i gather, try this :
RewriteRule ^blog$ /subs/blog [L]
and save it in your roots (www) folder's .htaccess
But i believe that your best bet would be to do a direct redirection such as
Options +FollowSymLinks
Redirect ~/subs/blog/ www.yourdomain.com/blog/
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.