Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel主页提供404,但index.php有效_Php_.htaccess_Laravel - Fatal编程技术网

Laravel主页提供404,但index.php有效

Laravel主页提供404,但index.php有效,php,.htaccess,laravel,Php,.htaccess,Laravel,我正在网站的子文件夹中创建自定义cms。我在www.mysite.com/cms/上安装了一个新的laravel副本,要在共享主机上使用laravel,我建议尝试一下 顺便说一下,在.htaccess中,您只是将所有不存在的请求查询重定向到公共目录中的index.php。由于这样的事实,您应该使用url.com/public进行访问。如果您要将公用文件夹的内容上载到/cms,而将其他文件夹上载到/cms_系统中,您可以更改path.php文件以反映这一点吗 所以,你会有这个: /cms

我正在网站的子文件夹中创建自定义cms。我在www.mysite.com/cms/上安装了一个新的laravel副本,要在共享主机上使用laravel,我建议尝试一下


顺便说一下,在.htaccess中,您只是将所有不存在的请求查询重定向到公共目录中的index.php。由于这样的事实,您应该使用url.com/public进行访问。

如果您要将公用文件夹的内容上载到/cms,而将其他文件夹上载到/cms_系统中,您可以更改path.php文件以反映这一点吗

所以,你会有这个:

/cms
    (contents of the public folder, with .htaccess)
/cms_system
    /application
    /bundles
    /laravel
    /storage
    (etc)
然后,您的路径将如下所示:

$paths['sys'] = 'system';
$paths['bundle'] = 'bundles';
$paths['app'] = 'application';
$paths['storage'] = 'storage';
$paths['public'] = '../cms';

我还没有测试过这个,但它应该可以工作。如果有任何问题,请告诉我,并查看可以相应更改的内容。

谢谢,我尝试了此功能,但无效。我得到的只是目录列表,有点不对劲。我尝试了很多次这种方法,并取得了成功。目录列表的内容是什么?它只是/cmsa的内容。根据方法,当您试图访问cms时,它不应该是任何列表,因为至少应该有index.php,并且它阻止了它。顺便说一句,根据该方法,您的根目录将是公共的,您做到了,对吗?/*-public->这将是您的cms文件夹--larasys--application--bundles--laravel--storage--path.php--artisan--index.php*/您是否已将.htaccess文件恢复正常?它现在应该指向cms目录。是的,我删除了我在这里发布的.htaccess代码,因为它不正确。也许应该删除请求URI部分,并且您的重写规则应该在路由开始时检查cms?哦,你设置好你的重写库了吗?老实说,我不太熟悉htaccess命令,我已经删除了上面的htaccess,因为它不正确,重写库是什么/cms?
'index' => '',
/cms
    (contents of the public folder, with .htaccess)
/cms_system
    /application
    /bundles
    /laravel
    /storage
    (etc)
$paths['sys'] = 'system';
$paths['bundle'] = 'bundles';
$paths['app'] = 'application';
$paths['storage'] = 'storage';
$paths['public'] = '../cms';