Laravel and WordPress as a subfolder
I wanted to recreate a small blog for a site I was building in Laravel for a bit of fun but didn’t want to waste/spend loads of time recreating a blog. When in my honest opinion WordPress does an un-touchably good job of that already.
If you want to just simply install WordPress in your Laravel install under a subfolder, it’s quite simple really. Just install into public/blog (or whatever you want to name your blog).
Mac terminal fan? Little SVN one liner for you.
cd public | mkdir blog && cd blog | svn co http://core.svn.wordpress.org/tags/3.5 .
If you don’t use the public folder as your vhosts root like me you could use a .htaccess rule instead.
# Apache configuration file
# http://httpd.apache.org/docs/2.2/mod/quickreference.html
# Note: ".htaccess" files are an overhead for each request. This logic should
# be placed in your Apache config whenever possible.
# http://httpd.apache.org/docs/2.2/howto/htaccess.html
# Turning on the rewrite engine is necessary for the following rules and
# features. "+FollowSymLinks" must be enabled for this to work symbolically.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Maybe something like that might help? But don’t hold me to it. You could also use a exclusion rule in your .htaccess file.
RewriteCond %{REQUEST_URI} !^/(~blog|/.*)$