简体   繁体   中英

Getting 404 error, due to .htaccess?

I'm working on a site on my localhost using Slim PHP, for RESTful services. One of the things that's been done is setting it up so that localhost/admin/client will return all information about clients in the Database. This all worked fine on Slim 1.4

Recently upgraded to Slim 2.4 however and my Apache server gives me a 404 error, saying the file isn't found.

.htaccess :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ api/router.php?url=$1 [L,QSA]

api/router.php :

$URL = explode('/', $_GET['url']);
$file = $URL[0].'.'.$URL[1].'.php';
if (file_exists($file)) {
    require($file);
}

The file it is looking for would be admin.client.php, obviously. However this returns as a 404 error. However, if I put echo("foo"); at the top of admin.client.php it gets shown on the 404 page. I've also checked my error.log file and there is nothing there from any of my attempts at using the page.

Thanks

#LoadModule rewrite_module modules/mod_rewrite.so

after removing # line will look like this:

LoadModule rewrite_module modules/mod_rewrite.so

and restart the service

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM