RouterListener.php行125中的NotFoundHttpException:未找到“ GET /”的路由

时间:2018-11-12 07:42:57

标签: php .htaccess

当我在cpanel中上传php项目时,出现此错误。我的.htaccess文件具有以下代码:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine on
    #uncomment next line if silex app root is in a mamp subdirectory
    RewriteBase /TeraaketService
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^ index.php [QSA,L]
</IfModule>

我是php新手,如何解决此问题?

1 个答案:

答案 0 :(得分:0)

将其替换为您的.htaccess文件:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /*your_project_name/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>