How to Run Laravel, HTML, and WordPress Together on the Same Domain (Without Conflicts)

Running multiple projects on a single domain can be challenging, especially when different frameworks and platforms are involved. A very common real-world requirement is to run:

  • A Laravel application
  • An HTML website
  • A WordPress blog

—all under the same domain.

In this blog, we will explain how to properly run a WordPress blog inside a subfolder when Laravel and HTML projects are already running smoothly, and how to fix the common “Oops! That page can’t be found” error in WordPress.


Understanding the Current Setup

Your server directory structure looks like this:

public_html/keralaorbit.com            → Laravel project
public_html/keralaorbit.com/public     → HTML project
public_html/keralaorbit.com/public/blog → WordPress project

Behavior observed:

  • Laravel project works correctly ✅
  • HTML site works correctly ✅
  • WordPress loads, but shows WordPress 404 page

This confirms that:

  • The server is accessing WordPress
  • But WordPress URL and rewrite configuration are incorrect

Why the WordPress 404 Error Happens

The error:

“Oops! That page can’t be found.”

is not a server error.
It is a WordPress internal 404, which usually happens when:

  • WordPress does not know its correct base URL
  • Permalinks are misconfigured
  • Rewrite rules do not match the actual folder path

In this case, WordPress is running inside:

/public/blog

But WordPress is not aware of this full path.


Step 1: Fix WordPress Site URL and Home URL (Most Important)

The fastest and safest way is to force the correct URLs in wp-config.php.

File Path

public_html/keralaorbit.com/public/blog/wp-config.php

Add the following lines before:

That's all, stop editing!

define('WP_HOME', 'https://keralaorbit.com/public/blog');
define('WP_SITEURL', 'https://keralaorbit.com/public/blog');

After saving, open:

https://keralaorbit.com/public/blog/

This step alone fixes most WordPress 404 issues.


Step 2: Fix WordPress .htaccess Rewrite Rules

WordPress permalinks require correct rewrite rules when installed in a subfolder.

File Path

public_html/keralaorbit.com/public/blog/.htaccess

Use This Configuration

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public/blog/
RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /public/blog/index.php [L]
</IfModule>
# END WordPress

This ensures all blog URLs route correctly through WordPress.


Step 3: Re-save WordPress Permalinks

Login to WordPress Admin:

https://keralaorbit.com/public/blog/wp-admin

Then:

  1. Go to Settings → Permalinks
  2. Click Save Changes (no need to change anything)

This regenerates rewrite rules automatically.


Step 4: Exclude the Blog Folder from HTML/Laravel Rewrite Rules

To avoid Laravel or HTML rewrite rules interfering with WordPress, update the .htaccess of the HTML project.

File Path

public_html/keralaorbit.com/public/.htaccess

Add This at the Top

RewriteEngine On

# Allow WordPress blog folder
RewriteCond %{REQUEST_URI} ^/public/blog($|/) [NC]
RewriteRule ^ - [L]

This tells the server:

  • Requests to /public/blog should bypass Laravel/HTML
  • WordPress should handle them directly

Why This Setup Works

  • Laravel continues to handle application routes
  • HTML pages load normally from the public folder
  • WordPress gets full control of /public/blog
  • No rewrite conflicts
  • No routing overlap

Important Notes

  • WordPress can run perfectly inside a subfolder
  • Laravel and WordPress do not conflict if rewrite rules are handled correctly
  • This setup is commonly used for content-heavy sites

Best Practice Recommendation (Optional)

For cleaner URLs and better SEO, consider running WordPress at:

https://keralaorbit.com/blog

instead of:

https://keralaorbit.com/public/blog

However, the steps above fully support your existing structure without changes.


Conclusion

If you are running Laravel, HTML, and WordPress on the same domain, a WordPress 404 error usually means URL and rewrite mismatch, not a server problem.

By:

  • Correctly setting WP_HOME and WP_SITEURL
  • Fixing WordPress rewrite rules
  • Excluding the blog folder from Laravel/HTML rewrites

—you can run all three projects smoothly on the same domain.


Leave a Reply

Your email address will not be published. Required fields are marked *