I have a main domain name : maindomain.com
, on which I can access DNS configuration and current linked server (only files, not configuration) and a "cdn" domain (not one the same domain) cdn.domain.com
on which I can access nearly everything
I want to transparent redirect request to subdomain (i.e. maindomain.com still in adress bar but cdn.domain.com reached) to reach my website on symfony
What I tried :
A 301 Redirect : (.htaccess)
RewriteEngine On
RewriteRule (.*) http://cdn.domain.com/$1 [R=301,L]
But this is not transparent as the URL change
A Proxy redirect : (.htaccess)
RewriteEngine On
RewriteRule ^(.*)$ http://cdn.domain.com/$1 [P]
But this doesn't seems to be activated on main server
I have some other solution to try, but I don't know if this could work and to avoid breaking the server I would like to know if this could work.
Edit server name in configuration and set DNS
<VirtualHost *:80>
ServerName maindomain.com
</VirtualHost>
maindomain.com
intead of current cdn.domain.com
.
And make DNS pointing to the server IP.
Can this configuration break other subdomains?
https://stackoverflow.com/questions/43632105/transparent-redirection-from-domain-to-subdomain
Externalise Symfony assets
As I don't have enough space on maindomain.com
current server, I wanted to
know if I could only store the whole site structure except assets (a
part of web/
directory ? And how this would work for file upload ?
Furtherome is this viable (time complexity) with an external database
(stored on cdn.domain.com
) ?