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

237
Visualizações
How to redirect through htaccess without changing the URL?

I am currently using the code below to point all subdomains to their document root.

RewriteCond %{HTTP_HOST} ^(.*)\.example\.co [NC]
RewriteRule ^(.*)/?$ http://example.co/%1/$1 [P]

subdomain.example.co will point to example.co/subdomain but the URL will remain untouched.

The problem with this is that when you try to retrieve the URL, through PHP, it will always return example.co/subdomain despite the fact that the URL bar displays it as a subdomain. I believe this is due to the Proxy flag.

How could I achieve the same effect but allow for the actual URL that the user is on (the subdomain) to be retrieved?

Overall

  • allsubdomains.example.co should point to example.co/allsubdomains

  • The URL should remain as allsubdomains.example.co

  • When retrieving the current URL through PHP, it should return allsubdomains.example.co

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