Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aspiresuvedi's avatar

Deploy Laravel 5 application on production server with apache

I have a working laravel 5 application with built in php server. But I encounter problem while deploying on a apache server. I have put this in .htaccess of project's root directory RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]

and this in .htaccess of public directory Options -MultiViews

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]

When I run http://localhost/myapp/ it shows blank page. Am I supposed do any other configurations for this to work ?

0 likes
8 replies
bashy's avatar

Blank page is never a blank page. What error is it? 500, 404?

May have to turn on debug or check error logs.

acydwarp's avatar

Add RewriteBase /myapp/ to your .htaccess file.

fruizcasas's avatar

Hi. Try with this.

~/XXX/public/.htaccess contents

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
1 like

Please or to participate in this conversation.