I need to add a new Laravel app to an existing WordPress website. Both will run via Apache webserver. The idea is that:

  • https://website.com/ -> WordPress website
  • https://website.com/laravelapp -> Laravel web application

In the filesystem, the root folder contains the WordPress files and a subfolder laravelapp contains the Laravel files (so, the laravel public folder is a subfolder of laravelapp).

When I browse these, this is the current returned result:

  • https://website.com/ -> returns the WordPress website, with working permalinks
  • https://website.com/laravelapp -> returns 403 error
  • https://website.com/laravelapp/public -> returns Laravel App

This shows me that mod_rewrite is available and working. But I want users to be able to just use the https://website.com/laravelapp to access that laravel app (not the public folder).

I’ve been trying to setup the .htaccess to make this arrangement possible, but am getting stuck. I currently have:

  • .htaccess on root of website

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/laravelapp [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
  • .htaccess on laravelapp folder

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /laravelapp/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/$1 [L]
  • .htaccess on laravelapp/public folder contains the standard laravel .htaccess file from the distributed package.

Is there any way to make this possible?

Read more here: WordPress with Laravel running on subfolder


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: