Search code examples
phpwordpressapache.htaccesslaravel

htaccess to allow laravel site inside of wordpress


I have a wordpress site set up domian.com Now i made a folder called scheduler and installed a laravel application. Inside my laravel application i have a .htaccess with the following inside the scheduler folder

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* public/index.php [QSA,L]

</IfModule>

and the following htaccess is the main server folder where the wordpress site lives

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

 # END WordPress

what i need to happen is domian.com/scheduler or domain.com/scheduler/..... should point to the scheduler directory and run the laravel app what am i doing wrong what do i need to add into the main directory htaccess


Solution

  • Add another rewrite rule with last L flag:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^scheduler($|/) - [L]
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress