WeiYoun

We young,we try,we fly

"The requested URL was not found"解决办法

I have the Rewrite commands in the .htaccess file like so:

RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [QSA,L]

 

I have the Slim hello code in the index.php file:

<?php require __DIR__ . '/vendor/autoload.php';date_default_timezone_set ( "America/New_York" );
// $log = new Monolog\Logger('name');
// $log->pushHandler(new Monolog\Handler\StreamHandler('app.log', Monolog\Logger::WARNING));
// $log->addWarning('Foo');$app = new \Slim\Slim();$app->get('/hello/:name', function ($name) {    echo "Hello, $name";});$app->run();?>

 

Yes, the monolog is working as is the datetime function.

I have tried to modify the base as instructed also, though I realize that really isn't the error I'm getting. Also, just for my FYI, does this look like the way to make the absolute path to my .htaccess file?

RewriteBase /Applications/MAMP/htdocs/SimplePHPWebsite/

 

Update: I've added code from the next video which is partially working, Snippet:

$app->get('/', function() {    echo 'Hello, this is the homepage.';});$app->get('/contact', function() {    echo 'contact us.';});

 

This works for the homepage, but not for the contact page.

I'm using localhost:8888 with MAMP

From:https://teamtreehouse.com/community/how-to-fix-the-requested-url-was-not-found-on-this-server-error-for-the-helloname-url

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

© ©2018-2021 Copyright Weiyoun.

本站会分享一些资源,可按需下载;还有一些建站经验及有趣的文章分享,欢迎常来!