7

I have a big problem. I work on an application in localhost with Lumen framework. My work environment is on Wamp (Windows).

Lumen requires the root to be in the public folder.

To do that, I have a configuration file like this :

NameVirtualHost name.local
<VirtualHost name.local>    
  DocumentRoot C:/wamp/www/name/public
  ServerName name.local  
</VirtualHost>

So, if I put the address name.local/ in my browser, I can reach to the index page.

Now, I need to put all my work in a FTP. And there, I have an exception error, which is normal because my root isn't the public folder.

UPDATE : I have find the answer, please see it below.

w3spi
  • 4,380
  • 9
  • 47
  • 80
  • FTP? file transfer protocol? or some other TLA (three-letter acronym) – Marc B Jun 09 '15 at 18:34
  • yes, using a software like filezilla – w3spi Jun 09 '15 at 18:36
  • ftp has nothing to do with php... what is this exception error, exactly? – Marc B Jun 09 '15 at 18:40
  • @MarcB Sorry, used tags. this : `Sorry, the page you are looking for could not be found.` – w3spi Jun 09 '15 at 18:42
  • Your question is not clear enough please calm down and elaborate your problem more clearly, it may take a couple of minutes to type but it will definitely get you an appropriate answer – Khan Shahrukh Jun 09 '15 at 19:25
  • It all depends on your server and hosting provider. If you can, use a similar virtual host config file. If not, you probably have access to some kind of control panel where you can set the document root of your domain/website – lukasgeiter Jun 09 '15 at 21:19
  • Ok thank you all for your answers – w3spi Jun 09 '15 at 21:26

1 Answers1

20

Ok, after days of search, I have found the solution.

Add a .htaccess file in the root of the application and add this in this file :

RewriteEngine On

RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

Assuming you haven't touched the original architecture of Lumen, and that public data is still in the same place : the public/ folder

EDIT :

With the last version of Lumen and Laravel, you just could write it in the .htaccess file :

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]

Or follow the second method of this tutorial

w3spi
  • 4,380
  • 9
  • 47
  • 80