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

97
Views
¿Cómo obtener una entrada de MYSQL según la URL ingresada?

Lo que quiero lograr es algo como lo que usa Wikipedia: ingresa "wikipedia.org/wiki/Stack_Overflow" en la barra de búsqueda de su navegador y wikipedia le muestra el artículo para "Stack_Overflow". Sé que podría hacer algo usando GET de php y www.website.com/article.html?article_name pero me gustaría saber cómo funciona la solución de wikipedia.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Debe volver a escribir TODO en index.php o router.php .

Así que en tu .htaccess puedes probar lo siguiente:

 # Rewrite ALL to index.php RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

Luego puede manejar la solicitud en su archivo index.php .

Puedes intentar algo así:

 $REQUEST_URI = $_SERVER['REQUEST_URI'] ?? ""; // get the REQUEST_URI $reqguestedURL = trim($REQUEST_URI, '/'); // remove the leading and trailing '/' $reqguestedURL = filter_var($reqguestedURL, FILTER_SANITIZE_URL); // sanitize the URL $URL_array = explode('?', $reqguestedURL); // explode the URL $destination = $URL_array[0]; // remove the query string $queryString = $URL_array[1] ?? ""; // get the query string $destinationParts = explode('/', $destination); // finally get the destination parts. // so if the URL is: example.com/foo/bar?name=value var_dump($REQUEST_URI); //OUTPUT: /foo/bar?name=value var_dump($reqguestedURL); //OUTPUT: foo/bar?name=value var_dump($URL_array); //OUTPUT: Array ( [0] => foo/bar [1] => name=value ) var_dump($destination); //OUTPUT: foo/bar var_dump($queryString); //OUTPUT: name=value var_dump($destinationParts); //OUTPUT: Array ( [0] => foo [1] => bar )

Y ahora puede obtener el valor de su base de datos.

about 4 years ago · Juan Pablo Isaza Report

0

Puedes hacer esto como WordPress. Significa que redirige todas las solicitudes http en un directorio específico a index.php (sin redirigir), luego puede procesar lo que desee con su archivo index.php.

Vea el contenido del archivo .htaccess predeterminado de WordPress aquí: https://wordpress.stackexchange.com/a/45899

about 4 years ago · Juan Pablo Isaza 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!