Fat Free 框架 URL 错误

发布于 2024-12-14 08:44:04 字数 1575 浏览 2 评论 0原文

我遇到问题了。我使用的是 Ubuntu,所有文件都位于 /var/www 中。它包含以下文件夹:

fatfree:contains the fat free framwork
F3Apps: contains index.php, .htaccess(contents shown below)

index.php 的内容是

<?php
require '../fatfree/lib/base.php';
F3::route('GET /',function()
{
    echo "root  entered";   
});

F3::route('GET /about',function()
{
    echo "about  entered";  
});

F3::run();
?>

当我将 URL 设置为 http://127.0 .0.1/F3Apps/,没问题,即它正在回显

root  entered

但是当我将 URL 设置为 http://127.0.0.1/F3Apps/about,我收到以下信息: 在此处输入图像描述

.htaccess 内容如下所示(.htaccess 位于文件 F3Apps 中):

# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteBase /F3Apps
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]

# Disable ETags
<IfModule mod_header.c>
    Header Unset ETag
    FileETag none
</IfModule>

# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A604800
</IfModule>

DocumentRoot "/var/www/html"
<Directory "/var/www/html">
    Options -Indexes FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
    Allow from All
</Directory>

I'm getting a problem. I'm using Ubuntu and all my files are located in /var/www. It contains the following folder:

fatfree:contains the fat free framwork
F3Apps: contains index.php, .htaccess(contents shown below)

The content of the index.php is

<?php
require '../fatfree/lib/base.php';
F3::route('GET /',function()
{
    echo "root  entered";   
});

F3::route('GET /about',function()
{
    echo "about  entered";  
});

F3::run();
?>

When I'm setting the URL as http://127.0.0.1/F3Apps/, it is ok, i.e. it is echoing

root  entered

However when I'm setting the URL as http://127.0.0.1/F3Apps/about, I'm getting the following:
enter image description here

The .htaccess contents is shown below(The .htaccess is in the file F3Apps):

# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteBase /F3Apps
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]

# Disable ETags
<IfModule mod_header.c>
    Header Unset ETag
    FileETag none
</IfModule>

# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A604800
</IfModule>

DocumentRoot "/var/www/html"
<Directory "/var/www/html">
    Options -Indexes FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
    Allow from All
</Directory>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离线来电— 2024-12-21 08:44:04

检查你的.htaccess,问题就在那里。或者为我们发布它的内容:)

Check your .htaccess, problem is there. Or post it's content for us :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文