I have 2 servers on digital ocean (Love them!), a varnish cache, and a wordpress backend.
http://domain.com is set to the varnish cache. server1.domain.com is set to the second server as a backend, so I can have direct access without hitting the cache.
I've set wordpress to use both domains any $_SERVER['hostname']. Loading Server1.domain.com works fine, all links go to server1.domain.com, but many files and stylesheets still say domain.com
It it possible to use a rewrite condition to look at the hostname, and if its server1.domain.com, and if so, redirect all domain.com to server1.domain.com?
I've seen redirects for www to domain.com, but I'm only looking to do this if the hostname is server1.domain.com
Related
How do I redirect all page requests for a site to archive.org?
Basically I want to redirect someone who visits https://example.com/[something] to http://web.archive.org/web/https://example.com/[something]
(This is for a site which I host but which will be retired when the domain expires. It is completely archived by Archive.org)
Using NGINX.
It was as easy as:
rewrite ^(/)(.*)$ http://web.archive.org/web/https://example.com/$2 permanent;
I have a website running with https on all pages. I would like to make a 301 redirection for a specific page to make it available only with http (not https).
This is my code :
Redirect 301 https://www.example.com/a-page http://www.example.com/a-page
This does not work, i run a Wordpress website. How to make it runs with a simple way ?
Thanks
What do your .htaccess do to HTTP/HTTPS?
Are you forcing all users to use HTTPS?
Because you can make both be usable depending on how you want your server to handle the requests and what the browser user has requested.
I have domain example.com pointing to Azure Application Gateway
In Application Gateway I use url based routing which routes traffic to Azure App Service (blog.azurewebsites.net), and ssl termination.
App Service this is wordpress site with WP_SITEURL and WP_HOME set to "example.com".
Now, if I go to:
https://example.com/post/ - works well
https://example.com/index.php - works well
https://example.com - redirect loop takes place
I run the WP Site on Azure App Service with Linux Environment.
Once I access my domain with HTTPS and the $_SERVER['REQUEST_SCHEME'] return 'http' instead of 'https'. It caused the problem is the WP Site loads all images, css, js.. with http
I fixed my case with these lines in wp-config.php file.
$_SERVER['HTTPS'] = 'on';
$_SERVER['REQUEST_SCHEME'] = 'https';
Can you try https://example.com/? (with the slash in the end).
Without slash, I guess it is not matching the path based rules.
I've got an asp.net website (let's say http://cdn.mysite.com) hosted on IIS and sat behind an Amazon CloudFront Distribution (using a CNAME to access the cdn.* url above, let's say the distribution URL is http://mysite.cloudfront.net).
If a user hits a folder/directory url without a trailing slash, the server will issue a redirect to the origin cdn url, so if a user navigates to http://mysite.cloudfront.net/thanks, they'll end up on http://cdn.mysite.com/thanks/ instead of http://mysite.cloudfront.net/thanks/
Any suggestions of how to fix this in asp.net / iis / cloudfront?
You're right - and rather than fighting it - have you configured CloudFront to whitelist host headers?
For each behaviour > Forward Headers > Select 'Whitelist' > Select 'Host' from the list and hit Add.
This setting ensures that the host header (mysite.cloudfront.net) is included in requests back to the origin (so make sure you've added mysite.cloudfront.net to your site bindings). I'd expect the redirect issued by IIS will use the correct domain name once this configuration is in place.
For a Meteor JS deployment, how do your point domain.com at the same deployment as www.domain.com?
I have the A record pointing at the same IP address as www., but I'm getting the "there is no site deployed at this address message":
http://emiliotelevision.com
It appears Meteor's servers are not smart enough to make the site on www.emiliotelevision.com, which is working, also work for the equivalent with out the www..
Is there a better solution for this than pointing at another one of your own servers configured to redirect to the www. version?
Use a CNAME record for both www.emiliotelevision.com and emiliotelevision.com that points to yourserver.meteor.com
You need to set a domain redirect. emiliotelevision.com should redirect to www.emiliotelevision.com.
Now you can meteor deploy to www.emiliotelevision.com.
You may be able to set up the redirect from where you purchased the domain main.