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

338
Views
¿Cómo redirigir la URL con barra diagonal en .htaccess?

Estoy tratando de redirigir mi url:

www.site.com/dashboard/invest-package.php?packageID=1

a

www.site.com/dashboard/invest-package/1

En realidad, resolví este problema con -

<a href="invest-package-'.$row['packageID'].'">Invest</a>

 RewriteRule ^invest-package-(.*)$ invest-package.php?packageID=$1 [QSA,L]

Pero quería hacer con "/" no me gusta usar "-". Las soluciones que encontré en Internet no funcionaron. Sigo recibiendo el error 404 no encontrado.

Aquí está mi enlace a invest-package.php

 <a href="invest-package/'.$row['packageID'].'">Invest</a>

y archivo .htaccess:

 Options -Indexes RewriteEngine On RewriteBase /dashboard/ RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteRule ^invest-package/(.*)$ invest-package.php?packageID=$1 [QSA,L]
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes probar este código:

 Options -Indexes -MultiViews RewriteEngine On RewriteBase /dashboard/ RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteRule ^invest-package/([\w-]+)/?$ invest-package.php?packageID=$1 [QSA,L,NC]

Es importante desactivar MultiViews , es decir, el servicio de negociación de contenido de Apache.

La opción MultiViews (ver http://httpd.apache.org/docs/2.4/content-negotiation.html ) es utilizada por Apache's content negotiation module que se ejecuta antes de mod_rewrite y hace que el servidor Apache coincida con las extensiones de los archivos. Entonces, si /file es la URL, Apache servirá /file.php sin ningún parámetro GET .

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!