Mobile app version of vmapp.org
Login or Join
Rivera981

: Transparent redirection from domain to subdomain I have a main domain name : maindomain.com, on which I can access DNS configuration and current linked server (only files, not configuration) and

@Rivera981

Posted in: #Apache #Dns #Htaccess #Redirects

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 (.*) cdn.domain.com/ [R=301,L]


But this is not transparent as the URL change

A Proxy redirect : (.htaccess)

RewriteEngine On
RewriteRule ^(.*)$ cdn.domain.com/ [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? 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) ?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Rivera981

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

Transparent Redirects do not exist on planet Earth

As mentioned in the comment there's no such thing as a transparent redirect, it either redirects or it doesn't.

CNAME Records for MASKING Domain

The method that your most likely looking for is a DOMAIN MASK, which doesn't redirect but fetches the content from the original domain without changing the website address. This is normally done using a CNAME record that points to the main domain.



Apache Multiple ServerAlias

The other option is that rather than using a MASK or Redirect you can simply tell your Apache to host the same content on both domains using multiple ServerAlias's, for example:


ServerAlias *.exampleA.com *.eampleB.com

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme