Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

327
Views
.htaccess redirigir cualquier dominio a un dominio aparte de un dominio específico, regla

Tengo dos dominios que apuntan a una raíz web y necesito forzar el tráfico a uno de esos dominios.

Pero eso significa que todo el tráfico al otro dominio no puede llegar a él.

Esta es mi regla actual a continuación

 RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ [NC] RewriteRule ^(.*)$ https://www.example.co.uk/$1 [L,R=301]

El segundo dominio que quiero permitir es edit.example.co.uk

Entonces, he intentado:

 RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk$ [NC] RewriteCond %{HTTP_HOST} !^edit\.example\.co\.uk$ [NC] RewriteRule ^(.*)$ https://www.example.co.uk/$1 [L,R=301]

Pero no hay alegría, y luego probé variaciones sobre ese tema sin suerte.

Creo que tal vez conceptualmente, ¿estoy luchando con el orden en que se procesan?

¡Cualquier idea sería recibida con mucha gratitud!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debe usar 2 reglas de redirección diferentes:

 RewriteEngine On # add https and www to example.co.uk in same rule RewriteCond %{HTTP_HOST} !^www\. [NC,OR] RewriteCond %{HTTPS} !on RewriteCond %{HTTP_HOST} ^(?:www\.)?(example\.co\.uk)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L,NE] # add https to edit.example.co.uk RewriteCond %{HTTPS} !on RewriteCond %{HTTP_HOST} ^edit\. [NC] RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

Asegúrese de borrar completamente la memoria caché de su navegador antes de probar estas reglas.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!