'How to install wordpress in laravel public folder

i also follow this link but this is not my solution - laravel and wordpress on the same domain(laravel in subfolder)
i want to add wordpress in my laravel site.
so i install all wordpress in my laravel's public folders. here i create one folder "blog" and in this folder i install my wordpress site.

but my problem is when i run my wordpress site like that localhost:8000/blog it work fine

But when i am try to oprn another link then laravel redirect me 404 page not found.

so how to run wordpress in laravel if make any changes in any file so please any one help me.

my laravel public folder's .htaccess look like that

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]



Solution 1:[1]

To run wordpress as subdirectory, you must change the .htaccess file inside worpress directory like below:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

Follow this guide for more information https://wordpress.org/support/article/giving-wordpress-its-own-directory/

Solution 2:[2]

Well that quite simple if you have a laravel application such as laravel. What you have to do is just:

  1. download wordpress form wordpress.org

  2. rename that downloaded wordpress folder to any name such as blog

  3. put that blog folder into a public directory of laravel

  4. put database credential of wordpress blog into wp-config.php

  5. as well as put laravel db credential in .env

  6. make change in .htaccess of laravel

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} http://localhost/laravel/public/$
    RewriteCond %{REQUEST_URI} !^/blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /blog/$1
    RewriteCond %{HTTP_HOST} http://localhost/laravel/public/$
    RewriteRule ^(/)?$ blog/index.php [L] 
    </IfModule>
    
  7. You can easily access your blog as http://localhost/laravel/public/blog

  8. It will start wordpress blog

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Taher A. Ghaleb