【问题标题】:Laravel 4 in a subfolderLaravel 4 在子文件夹中
【发布时间】:2014-07-10 22:40:35
【问题描述】:

我在 Laravel 4 上有一个测试项目,但我还是新手。我仍在研究 wamp(本地主机)。只要 laravel 安装在 wamp (..wamp/www) 的根路径上,我就已经让它工作了,但是当我尝试创建另一个文件夹 (..wamp/www/testproject) 并在那里安装 laravel 时,路由除了 localhost/testproject/laravel/public 之外不再工作了。

总结一下:

--The working one---
C:/wamp/www/laravel               = the folder where laravel was installed
localhost/laravel/public          = working, "You have arrived" page
localhost/laravel/about           = working about.php route

--The one with errors--
C:/wamp/www/testproject/laravel        = the folder where laravel was installed
localhost/testproject/laravel/public   = working, "You have arrived" page
localhost/testproject/laravel/about    = not working about.php route
localhost/testproject/laravel/index.php/about = working, and I don;t know why

有人可以帮我解决这个问题吗?为什么“about.php”页面在子文件夹上不起作用? :(

编辑:.htaccess 文件内容

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

这是路线的屏幕截图..

【问题讨论】:

  • 您的根文件夹或 /public/ 文件夹中是否有 .htaccess 文件?
  • 是的,来自有错误的那个和工作的那个.. 该怎么办?
  • .htaccess 的内容是什么?
  • 编辑了代码.. 嗯
  • 嗯.. 你也可以打印出你的路线吗? php artisan routes 在您的子文件夹中安装 Laravel

标签: html web laravel


【解决方案1】:

.htaccessRewriteEngine On下方添加RewriteBase /laravel/public

【讨论】:

    猜你喜欢
    • 2014-06-15
    • 1970-01-01
    • 1970-01-01
    • 2015-03-11
    • 1970-01-01
    • 1970-01-01
    • 2015-02-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多