[英]Laravel URL Rewrite
To go directly to the controller on my laravel access by accessing : 通过访问以下命令直接进入我的laravel访问控制器:
http://localhost/laravel/public/home
Do i have to dont use /public ? 我不必使用/ public吗? Can I just use :
我可以使用:
http://localhost/laravel/home
Is this because the directory is on the public folder that causes this and should be like this? 这是因为目录位于导致此问题的公用文件夹上,并且应该像这样吗?
Thanks 谢谢
Depends where your instance of Laravel is located, and whether rewrite rules have been set. 取决于您的Laravel实例位于何处,以及是否设置了重写规则。
Assuming your Apache/nginx document root is /my/dir/ and your public folder is /my/dir/public/ (which makes the Laravel directory /my/dir/laravel/), you will need the /public/. 假设您的Apache / nginx文档根目录为/ my / dir /,公共文件夹为/ my / dir / public /(这使Laravel目录为/ my / dir / laravel /),则需要/ public /。
However, if your root dir is /my/dir/ and your laravel folder is in /my/laravel/, you can rename public to dir and skip using the public part, as it is now mapped to the documentRoot for the webserver. 但是,如果您的根目录为/ my / dir /,而laravel文件夹位于/ my / laravel /中,则您可以将public重命名为dir并跳过public部分,因为它现在已映射到Web服务器的documentRoot。
You can change all the paths in multiple places: 您可以在多个位置更改所有路径:
paths.php
file (which defines all the other paths) is in index.php
in your public folder paths.php
文件的位置(定义了所有其他路径)在公用文件夹的index.php
中。 paths.php
, one by one. paths.php
中一一定义。 The public one is $paths["public"].
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.