resolve URL domain with external subdomain contents - apache

I've purchased a new domain, lets call it example.ca.
I need the above URL to resolve in the browser, with the contents of another site, in this case www.test.ca/othersite
The expected behaviour is so when a user types example.ca, the site will load the contents of the www.test.ca/othersite, while still appearing the above URL as example.ca
I am not looking for a redirect, so wondering how this can be done using DNS and apache rules. Any help is appreciated!

Related

Redirect a specific single web page from one domain to a specific web page under another domain

How do I get the following redirect to work?
The old address contains URL parameters:
olddomain.com/Index.asp?CategoryID=2379&ArticleID=6592
And needed to redirect to a regular URL under the new domain:
newdomain.com/example-page
Can I do it via mod_rewrite on on my .htaccess file? what is the correct command for this redirection?
I will need to do that for each page under the old domain (the target URL under the new domain will be different for each page)
Actually nothing, the only solution I found was to redirect the entire domain to the new domain, without redirecting each page to it's target.

url subdomain wildcard redirect

I read some of the answers related to the topic but my situation is a little different. I'm hosted on GoDaddy shared Linux hosting. Currently my application is setup to handle uri's as follows:
https://state.domain.com/region/client/xyz/function1
I want to change the application so the new url will be as follows. The change has been implemented and working for new clients but for my existing clients I want to this to be seamless without having them to update the url they are using to access the application. The new url would be:
https://country.domain.com/state/region/client/xyz/function1
We have quite a few clients that are using the application and I was wondering if we can use wildcards to create generic redirection. What would be the best way to achieve this?
I was reading subdomain redirection through htaccess but in my case I need the generic redirection to give me the complete uri so for example in the above case the redirected uri should be exactly as specified above. In another case if the incoming request is for
.../region/client/xyz/function2
It should be redirected to
.../state/region/client/xyz/function2
Any help would be really appreciated

redirect a subdomain to a remote url, preferably via only DNS setting or with httpd.conf, without changing url displayed

For example I wish to redirect list.mydomain.com to http://my.emailingapp.com/lists/
but keeping the name displayed in URL as "list.mydomain.com".
Note that all parameters are to be passed over. e.g. list.mydomain.com/?stuff=a should be the same with http://my.emailingapp.com/lists/?stuff=a
Another note: these domains are on different server.
There are many other similar posts, but all of them does not work exactly as I wanted to.
Adding a CNAME record for list.mydomain.com to my.emailingapp.com using which you can achieve the following.
URL remains list.mydomain.com
The arguments get displayed in URL as list.mydomain.com/?stuff=a
Your requirement of having /lists/ should be implementable by URL rewrite rules.

Redirecting from subdomain to query string

There is a list of options in my website home page - for example, http://example.com. When a user clicks on option1, I want to show the URL as http://option1.example.com and not http://example.com/xyz.php?opt=option1. Any help or guidance would be appreciated.
You will either need to create a subdomain for each option and then provide the required code at that subdomain. how you set that up varies by hosting provider.
Do you really need a seperate subdomain per option?
Could you use http://abc.ca/Option1/ or http://abc.ca/Options/1/ instead?
If not you will need to contact your hosting providers about creating subdomains option1.abc.ca etc and where to put your php pages.
If you are hosting your own server with apache, I think it is possible to use a * dns entry to accept all subdomains and then you can use $_SERVER variables to get the domain being requested.

redirect in .htaccess

I am trying to point www.mydomain.example/blogs to www.anotherdomain.example/blog.html and still keep the URL the same, any ideas?
I have tried so many different methods and the URL changes to the URL im am redirecting to.
Thanks
Unless both domains are hosted on the same server and you have access via the file system, you will probably need a proxy on mydomain.example that forwards the requests to anotherdomain.example, fetched the response and forwards it back to the client.