Laravel and Wordpress as a subfolder

December 28, 2012

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 .

If you don't use the public folder as your vhosts root like me you could use a .htaccess rule instead.

# Apache configuration file
# Note: ".htaccess" files are an overhead for each request. This logic should
# be placed in your Apache config whenever possible.
# Turning on the rewrite engine is necessary for the following rules and
# features. "+FollowSymLinks" must be enabled for this to work symbolically.

	Options +FollowSymLinks
	RewriteEngine On

# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]

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|/.*)$

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.