I want to redirect (beta.mysite.com) subdomain, which is on another server (I only changed the DNS A record) to my main domain site, but would like to send with parameters like mysite.com?beta=1, and keep the subdomain url like beta.mysite.com.
On the main site I'd like to check the url (with get method) and if it's equal with my conditions I'd change the content with PHP.
Is this possible to do?
Thanks in advance!
You will require a reverse proxy server to do that. Which you can setup on beta.mysite.com and perform the proxy request with additional params.
You can use any of the reverse proxy servers . eg. HAPROXY, nginx etc.
Related
I have a site where I am loading country-based dynamic contents. While Laravel's Request::ip() gets the proper(original) client IP if user visits the domain.com version, www.domain.com version gets the same IP for all visitors. I suppose it's the NS resolver server somewhere or something I am not aware of.
Is there a way to set the www version with redirects or something else so that $_SERVER['X-Forwarded-For'] or $_SERVER['HTTP_X_FORWARDED_FOR'] or $_SERVER['REMOTE_ADDR'] gets the original client's IP? It's a Cpanel, so I don't have all the independence on all the DNS components to forward everything as per my need with custom Apache or Nginx setup. I just need a bypass, so to speak, if any.
It is generally a bad setup if you allow clints to access a website with two different URLs i.e. www and non-www. This is because Google sees these as two different websites and logs stats for them separately. This is of course not ideal if you want good SEO. You should re-direct all clients to one URL, choose either www or non-www.
To achieve this you can create a redirect rule in your server configuration files.
I have set up a web farm with ARR, using SSL offloading. Although the connection from ARR to the content site is proceeding with just HTTP, the application running on the site needs to know the original URL was HTTPS, so that links given in the result can be HTTPS. Can this be done?
I know I can capture the original HTTPS status as a new server variable (I'm using HTTP-X-ORIGINAL-HTTPS) using URL Rewrite on the ARR server. But how can I restore it to the content site using URL Rewrite? Obviously a redirect rule is not appropriate; a none action that sets server variables seems like it might be. I don't have an SSL binding on the content site. Do I have to make my content application look for the HTTP-X-ORIGINAL-HTTPS? Seems ugly.
Eventually I did -- I made the content application look for the request header HTTPS. (I have also switched from ARR to haproxy because haproxy gives me wildcard-bound TLS termination for free.)
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
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.
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.