删除Laravel Lumen公共路径Ubuntu云服务器

时间:2016-04-08 10:41:12

标签: laravel ubuntu apache2 lumen lumen-5.2

我正在尝试删除ubuntu服务器14.04 LTS上流明5.2的公共路径

这是我的.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On 
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

我已经在我的apache上允许 mod_rewrite

还将此添加到我的apache2.conf以允许Overrides

<Directory /var/www/html/lumen>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

我收到了错误

Sorry, the page you are looking for could not be found.

但是如果我将public路径添加到url就可以了。谁有这个麻烦?

我正在尝试制作网址 http://www.example.com/publichttp://www.example.com/

2 个答案:

答案 0 :(得分:0)

更改

<Directory /var/www/html/lumen>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

<Directory /var/www/html/lumen/public>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

因为您的文档根目录是public。并从public/

中删除.htaccess

答案 1 :(得分:0)

解决此问题:

恢复原始.htaccess,绝不编辑。

编辑你的Apache配置文件,你应该有这样的东西:

<VirtualHost *:80>
  ServerName myapp.localhost.com
  DocumentRoot "/var/www/html/lumen/public"
  <Directory "/var/www/html/lumen/public">
    AllowOverride all
  </Directory>
</VirtualHost>

重启Apache。