Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

260
Visualizações
Trying to put AWS CloudFront as CDN for WordPress website hosted outside of AWS Cloud - how to access a wordpress site with 2 different sub-domains

So, I am trying to put a WP website hosted outside of AWS behind a AWS CloudFront distribution. Now for custom origin AWS CloudFront wants you to enter the domain of the origin server. So, my DNS is set like this:

Cname example.com points to cloudfront distribution domain

A Record origin.example.com points to the IP of my origin server.

Now on my origin server which is a WordPress site, site_url is set to example.com. - in this case, when CloudFront tries to access my origin using origin.example.com it gets redirected to example.com, which results in too many redirects error. If I change the site_url to origin.example.com, then I get the homepage correct but hostname to all the other linked resources is set to origin.example.com which beats the purpose of using CloudFront.

So, I have to keep the site_url set to example.com but also want to access the site using origin.exmaple.com with the condition that WordPress should build the links using example.com hostname.

I tried hostname rewrite via .htaccess

RewriteEngine On

RewriteCond %{HTTP_HOST} !^(\.)?example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [PT]

But it is redirecting the request. I need a way so that the request is not redirected but hostname is replaced for the same request. Or maybe some other way to use CloudFront in front of WordPress site as the origin server.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda