Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

345
Vistas
How to redirect url with forward slash in .htaccess?

I'm trying to redirect my url:

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

to

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

Actually I solved this problem with -

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

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

But I wanted to make with "/" don't like using "-". Solutions I found on the internet didn't work. I keep getting 404 not found error.

Here is my link to invest-package.php

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

and .htaccess file:

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 Respuestas
Responde la pregunta

0

You may try this code:

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]

It is important to turn off MultiViews i.e. the content negotiation service of Apache.

Option MultiViews (see http://httpd.apache.org/docs/2.4/content-negotiation.html) is used by Apache's content negotiation module that runs before mod_rewrite and makes Apache server match extensions of files. So if /file is the URL then Apache will serve /file.php without any GET parameters.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda