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

186
Views
cómo obtener una URL inteligente de PHP

Mi sitio web tiene una URL como esta

 domain.com/profile.php?id=your_profile_id

ahora, ¿cómo lo convierto en una URL como esta?

 domain.com/profile/your_profile_id

Intenté esto en .htaccess

 RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]

y solo me ayuda a eliminar la extensión .php. no es exactamente lo que quiero. Gracias por adelantado. qué tengas un lindo día.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Con sus muestras mostradas, intente seguir las reglas. Asegúrese de colocar su archivo htaccess junto con su archivo profile.php.

Además, asegúrese de borrar la memoria caché de su navegador antes de probar sus URL.

 RewriteEngine ON RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/(.*)/?$ $1.php?id=$2 [QSA,L]
over 4 years ago · Santiago Trujillo Report

0

¿Qué quieres hacer en realidad? vea si desea mostrar el resultado según la URL en ninguna página existente / código de página 404 en la página 404, si solo desea la URL para las declaraciones, puede ir con simple $_SERVER['REQUEST_URI'];

después de obtener la URL, realice tal

 $myURL = $_SERVER['HTTP_REFERER']; // eg https://www.anything.com/profile.php?id=your_profile_id $myURL = str_replace("https://","",$myURL ); $myURL = str_replace("http://","",$myURL ); $myURL = str_replace("www.","",$myURL ); $myURL = str_replace(".php","",$myURL ); $myURL = str_replace("?","/",$myURL ); $myURL = str_replace("id=","",$myURL ); output : anything.com/profile/your_profile_id
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!