Suppose there is a website www.example.com with a web hosting account (Shared Hosting - Linux Server).

There is another website www.example2.com with a web hosting account (Shared Hosting - Linux Server) and having a sub-folder named example

I want to make configuration in such a way that when user opens http://www.example.com or http://example.com or https://www.example.com or https://example.com, the website lying under www.example2.com/example should get open but in the url bar, it should show example.com and its subpath. Visitor should get a feel that he is still on example.com, he should not know that the files of example.com are lying in example2.com/example

Codeigniter is mentioned here because the website present in example2.com/example is built using Codeigniter.

I have gone through various questions regarding URL masking on this forum and found the following solutions:

  1. Using Iframe, but seems like it is not a perfect approach as it might hurt responsiveness and SEO, if not done with expertise.

  2. Using Add on Domain, but add on domain facility is not available on my server, I can just create Domain Aliases

  3. ProxyPass: I am not sure about it, never heard of it before and couldnot find a detailed implementation guidance.

  4. mod_proxy with mod_redirect: Again, I am not sure about it, never heard of it before and couldnot find a detailed implementation guidance.

  5. Someone said: You must then configure your home server to accept requests for this subdomain. (Probably through a ServerName or ServerAlias directive in a on your home (web) server.) Can this be done on my shared hosting server where I have limited access?

UPDATE I have tried the following:

RewriteBase "/"
RewriteRule "^/(.*)$" "http://example2.com/example/$1" [P]
ProxyPassReverse "/" "http://example2.com/example/"

I got the following:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

Where I am wrong.

  • Presumably example.com and example2.com are pointing to two entirely different (shared) servers? – MrWhite Mar 16 at 23:01
  • @MrWhite Yes, they are going to be on separate servers. – ITSagar Mar 18 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.