Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Remove public from url lumen

I'm working on an microservice based arhitecture with Lumen. The local environement is working fine, but the production server needs adjustments, because it can't have the same link structure, and I want the code to be the same in every env.

In the local env I created virtual hosts for every microservice, like for e.g. books.xyz, and authors.xyz that point to the /public folder, so link structure DOESN'T contain public. On live, it is hosted like server .servername.com/books and beta.servername.com/authors. I have started developing an admin panel with lumen ( /admin ) but the problem is that the link structure is too different, and doesn't work on production. ( css/js assets get 404'd etc.)

How can I remove the /public in the production URL?

I don't want to move everything from public folder into root, because of security reasons!

I have tried creating a .htaccess file on the root, and the following, but none of them worked :

# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{REQUEST_URI} !^/books/public/
# RewriteRule ^(.*)$ /public/$1 [L,QSA]
# RewriteRule ^game/(.*)$ /books/public/$1 [L,QSA]
# </IfModule>

or

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

or

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ books/public/$1 

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!