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

277
Views
El sistema de enrutamiento PHP altorouter no funciona

Solo estoy desarrollando un sitio web con PHP y para el enrutamiento, decidí no construir todo el sistema yo mismo, luego elegí altorouter/altorouter. Así que aquí está mi árbol de sitios mi árbol de sitios

Y así es como se ve mi index.php

 <?php define('WEBROOT', __DIR__); define('TARGET_PATH', WEBROOT.'/contents'); require 'vendor/autoload.php'; $router = new AltoRouter(); $router->setBasePath('/kpitalis.com/'); require_once 'config/routes.php'; $match = $router->match(); $target = $match['target']; $params = $match['params']; if (is_array($match)) { if (is_callable($match['target'])) { call_user_func_array($target, $params); } else { ob_start(); require TARGET_PATH."/{$target}.php"; $pageView = ob_get_clean(); } require TARGET_PATH."/frame/layout.php"; } else { require TARGET_PATH."/error.php"; }

El archivo de mis rutas routes.php se ve así:

 <?php $router->map('GET', '/', 'home', 'home'); $router->map('GET', '/contact', 'contact', 'contact'); $router->map('GET', '/about', 'about', 'about'); $router->map('GET', '/achievements', 'achievements', 'achievements'); $router->map('GET', '/achievements/[*:slug]', 'achievements', 'achievement'); $router->map('GET', '/projects', 'projects', 'projects'); $router->map('GET', '/projects/[*:slug]', 'projects', 'project'); $router->map('GET', '/news', 'news', 'news'); $router->map('GET', '/news/[*:slug]', 'news', 'single_news'); ?>

Y mi .htaccess

 Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

La cosa es que puedo obtener rutas cuando ejecuto el servidor PHP sel pero no puedo mis archivos css y javascipt (digo Ok, puedo arreglarlo más tarde) Ahora estoy tratando de ver cómo funciona en mi localhost pero todo Puedo llegar a la página de error error.php

¿Qué me estoy perdiendo?

over 4 years ago · Santiago Trujillo
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!