请求的文件没有在此服务器上找到

The requested document was not found on this server

我想我必须把它写在 web.config 文件上。我的服务器没有响应 .htaccess 文件。我如何将此 .htaccess 转换为 web.config 文件。请帮忙。

我使用 xampp 作为本地服务器,我的网站可以在其中正常运行。 但是当我将它上传到 plesk 时,只有索引页面在工作,但索引中的所有其他 link 都不起作用。我的网站是d-subidha.com 其他link 会报错如下.

未找到 在此服务器上找不到请求的文档。

<?php
/**
 * Front controller
 *`enter code here`
 * PHP version 7.0
 */
 /**
 * Composer
 */
require dirname(__DIR__) . '/vendor/autoload.php';
/**
 * Error and Exception handling
 */
error_reporting(E_ALL);
set_error_handler('Core\Error::errorHandler');
set_exception_handler('Core\Error::exceptionHandler');
/**
 * Sessions
 */
session_start();


/**
 * Routing
 */
$router = new Core\Router();

// Add the routes
$router->add('', ['controller' => 'Home', 'action' => 'index']);

$router->add('search', ['controller' => 'Home', 'action' => 'search']);

$router->add('login', ['controller' => 'Login', 'action' => 'new']);
$router->add('logout', ['controller' => 'Login', 'action' => 'destroy']);
$router->add('password/reset/{token:[\da-f]+}', ['controller' => 'Password', 'action' => 'reset']);
$router->add('signup/activate/{token:[\da-f]+}', ['controller' => 'Signup', 'action' => 'activate']);

$router->add('{controller}/{action}');

$router->dispatch($_SERVER['QUERY_STRING']);

这是我的 .htaccess 文件

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php? [L,QSA]

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?_url=/ [QSA,L]

My files/folders structure for site is

您在此处配置服务器时搞砸了:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?_url=/ [QSA,L]

您实际上将路由配置为以这种方式工作:

d-subidha.com/login

但由于您的服务器配置,它没有在您的路由中找到任何路径,因此它给出了 404。要解决此问题,请更改您的服务器重写规则。 通过使用“?”导航到 url,您的站点正在运行。例如

d-subidha.com?login

附上工作截图。

像这样设置链接:

https://d-subidha.com/index.php?login

它对我有用。 或者更改您的 RewriteRules。