I am trying to host a WordPress site inside a Laravel(5.1) project. I have the following structure (stripped down some)
├── app
├── config
├── public
│ ├── index.php
│ ├── wordpress -> ../wordpress
│ └── .htaccess
├── resources
├── storage
├── vendor
└── wordpress
├── index.php
├── wp-admin
├── wp-config.php
├── wp-includes
└── .htaccess
The vhost document root is public.
The Wordpress should catch everything that falls through the .htaccess. But for example /login should go to laravel. When my project grows i intend to add more rules to catch requests for Laravel. I have the following .htaccess file in /public:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule "^/login" "index.php" [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule "^(.*)$" "wordpress/$1" [L]
</IfModule>
But when i make the request to /login i still end up with the wordpress page. Here is a part of the log:
add path info postfix: /var/www/public/login -> /var/www/public/login/
strip per-dir prefix: /var/www/public/login/ -> login/
applying pattern '^/login' to uri 'login/'
add path info postfix: /var/www/public/login -> /var/www/public/login/
strip per-dir prefix: /var/www/public/login/ -> login/
applying pattern '^(.*)$' to uri 'login/'
RewriteCond: input='/var/www/public/login' pattern='!-d' => matched
RewriteCond: input='/var/www/public/login' pattern='!-f' => matched
rewrite 'login/' -> 'wordpress/login/'
add per-dir prefix: wordpress/login/ -> /var/www/public/wordpress/login/
strip document_root prefix: /var/www/public/wordpress/login/ -> /wordpress/login/
internal redirect with /wordpress/login/ [INTERNAL REDIRECT]
It seems like the rewriting does not stop at the [L] flag.