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

89
Visualizações
Server Redirect With Ports?

I don't have much experience with Apache or servers, so my apologies if this is a stupid question. I am trying to redirect http://example.com:5557 to http://203.0.113.111:5557. Is this something I can do in the .htaccess file and, if so, what would that look like?

Here is my idea:

Redirect 301 "http://example.com:5557" "http://203.0.113.111:5557"
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Yes, you can do this in .htaccess, but not with the mod_alias Redirect directive. The Redirect directive matches against the URL-path only. You need to match against the HTTP Host request header, which contains the hostname + port number.

Try the following using mod_rewrite instead:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example\.com:5557$ [NC]
RewriteRule ^$ http://203.0.113.111:5557/ [R=301,L]

Note that this redirects the document root (homepage) only, as stated in your example. If you need to redirect any URL to the same URL at the target domain then use the following RewriteRule instead:

:
RewriteRule ^ http://203.0.113.111:5557%{REQUEST_URI} [R=301,L]

NB: Test first with 302 (temporary) redirect to avoid potential caching issues.

over 4 years ago · Santiago Trujillo Relatório
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