Laravel 4在子目录下

时间:2014-05-22 03:56:46

标签: html web laravel

我在Laravel 4上有一个测试项目,我还是新手。我还在研究wamp(localhost)。只要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>

这是路线的截图.. routes

1 个答案:

答案 0 :(得分:-1)

RewriteBase /laravel/public

中的RewriteEngine On下方添加.htaccess