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

239
Views
Reescriba la URL que coincida con un directorio, tenga una consulta HTTP específica y NO tenga una combinación de consulta HTTP específica

Me he encontrado con muchas preguntas relacionadas con la redirección basada en consultas HTTP y, por supuesto, la coincidencia de partes parciales de las URL, pero no ambas .

Mi estructura de directorios se parece a lo siguiente:

  • http://localhost/common_parent/.htaccess
  • http://localhost/common_parent/demo/themes/
  • http://localhost/common_parent/themes/?ajax=1

La reescritura que tengo funciona bien, excepto que bloquea el directorio en el segundo elemento de la lista:

 RewriteCond %{REQUEST_URI} !\.xml$ RewriteRule ^[^/].*/themes(.+) themes$1 [L]

Lamentablemente, tanto demo/themes/?ajax=1 como themes/?ajax=1 se solicitan con la consulta HTTP ajax . Sin embargo, solo se solicita la demo/themes/ con una consulta HTTP foo .

  • http://localhost/common_parent/demo/themes/?ajax=1&foo=bar
  • http://localhost/common_parent/themes/?ajax=1

Entonces, en resumen, ¿cómo reescribo mi rewrite para que solo se aplique si la consulta ajax http está presente y, al mismo tiempo, la consulta foo http no está presente?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puede usar la regla de reescritura como esta:

 # when ajax=<whatever> query parameter is present RewriteCond %{QUERY_STRING} (?:^|&)ajax= [NC] # when foo=<whatver> is not present RewriteCond %{QUERY_STRING} !(?:^|&)foo= [NC] # when URI is not ending with .xml RewriteCond %{REQUEST_URI} !\.xml$ [NC] # rewrite handler RewriteRule ^[^/].*/themes(.+) themes$1 [L]
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!