Trusted Bespoke Software & eCommerce Solution Developers

Trusted Bespoke Software & eCommerce Solution Developers.

How to install a WordPress Blog to your Laravel Web Application

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller architectural pattern and based on Symfony.

WordPress is a content management system based on PHP and MySQL that is usually used with the MySQL.

Creating a blog using Laravel isn’t difficult but why create something which is already existing and solve our primary purpose? Yes, I’m talking about WordPress. WordPress is trusted and rock-solid as a blogging platform, so let’s just install it alongside our Laravel Web Application.

So one may ask — why do I need to think of adding a blog to a Laravel app? The answer to the question is simple — the benefits of SEO(Search Engine Optimization) & MOZ Rank (Domain Authority)


Who's this for?

If you are one who understands the importance of DA & SEO Scores and wants a blog within your primary domain (ex., this article is for you.

Let’s assume you have:

  1. Web Server
  2. A Web server running on top of Ubuntu with Apache
  3. LAMP stack


Step 1: Download A Copy of WordPress

Download the latest copy of WordPress available to a temporary location. When you download the file, it will be in a zipped package. You can download the same in CLI mode using the following command.

curl -O



Not sure how to access server CLI? -  For Windows System and for MAC follow my previous video on How to add domain and host websites on DigitalOcean droplet.

If you are not comfortable with the commands, download the zip file and upload it to a temporary location on your web server. Wondering how to upload files to the server? — Check this video.

Step 2: Create a Blog Directory For The WordPress Files

For such Laravel-WordPress integration, we will configure it in such a way that when you visit the Laravel application that currently resides on the root domain, you will be able to append a /blog to the domain and reach your blog.

Let’s say, your Laravel project domain is, we will ensure that blog traffics are pushed to with full support for pretty URLs, administration control and all the other bells and whistles of WordPress without disturbing the existing Laravel application.

This is how to complete the Laravel-WordPress integration.

  1. Create a blog directory within the public directory of your Laravel Installation
  2. Place all the WordPress files in the blog directory
  3. Create a new database on your server to support the new WordPress install
  4. Update your apache configuration
  5. Restart the apache service
  6. Install WordPress

Note: Again, we make a few assumptions for this tutorial. One being that you have your own VPS, and two being that it is a LAMP stack. LAMP is Linux, Apache, MySQL, and PHP.

The index.php file in the Laravel project public directory is the entry into your Laravel application. You will load the WordPress files into the public/blog directory so that the index.php file for WordPress exists in the blog directory. This is the entry into your WordPress blog.

Step 3: Create a database for the WordPress install

If you have a GUI tool such as phpmyadmin installed, this will be an easy process. If not, follow the video

Step 4: Update Apache Configurations

Change the .htaccess file located within your WordPress or blog directory, if it does not exist use the following command

nano .htaccess


touch .htaccess
nano .htaccess

and paste the below configuration in the .htaccess file

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* -

# Redirect Trailing Slashes If Not A Folder…
# RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} (.+)/$
#RewriteRule ^ %1

# Handle Front Controller…
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php

The below settings will cause your posts infinite redirection, so ensure to comment these out

# Redirect Trailing Slashes If Not A Folder…
# RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} (.+)/$
#RewriteRule ^ %1

Once you have updated the apache configuration file, be sure to restart the apache service using the following command

sudo service apache2 restart

Step 5: Configure wp-config.php

Set up your database configuration for the blog by renaming wp-config-sample.php it to wp-config.php and fill in the credentials to connect to the new database you created in step 3.

One can manually change the wp-config.php file or let the WordPress installer do it for you. If you wish the WordPress installer to create the wp-config.php file, hit the URL

A snippet of that configuration file might look a bit like this.

// ** MySQL settings — You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */
define(‘DB_USER’, ‘YOUR-USER-NAME’);

/** MySQL database password */

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

/** Database Charset to use in creating database tables. */
define(‘DB_CHARSET’, ‘utf8’);

/** The Database Collate type. Don’t change this if in doubt. */
define(‘DB_COLLATE’, ‘’);

Step 6. Run Through the WordPress Install

With all of the legwork out of the way, you can now point a browser to and you will be greeted with the familiar install screen of a WordPress installation. Fill out the fields as needed and submit the data, and you should now have your working blog right alongside your Laravel application on the same domain.

Abhijit Das
CEO & Co-Founder
Table of Contents

Are you looking for a reliable & trustworthy technology vendor for your organization?

These brands trust us for their enterprise app & modernization requirements.

Recommended Posts

Let’s transform your business

We have successfully launched 50+ apps for businesses from all around the world. We take pride in our ability to deliver quality apps on time and within budget.