-1

I'm trying to remove public path on lumen 5.2 on a ubuntu server 14.04 LTS

Here is my .htaccess

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

I already allow mod_rewrite on my apache

also added this to my apache2.conf to allow Overrides

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

I'm getting the error

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

But if I added the public path to url it works. Any one having this trouble?

I'm trying to make the url from http://www.example.com/public to http://www.example.com/

patricus
  • 59,488
  • 15
  • 143
  • 145

2 Answers2

0

Change

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

To

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

Because your document root is public directory. And remove that public/ from .htaccess

Giedrius Kiršys
  • 5,154
  • 2
  • 20
  • 28
0

To fix this:

Restore your original .htaccess and never edit it.

Edit your Apache config file, you should have something like this:

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

Restart Apache.

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279