且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Laravel公用文件夹中安装Wordpress

更新时间:2022-10-19 13:30:00

要将wordpress作为子目录运行,必须在worpress目录中更改.htaccess文件,如下所示:

 < IfModule mod_rewrite.c>RewriteEngine开RewriteBase/博客RewriteRule ^ index \ .php $-[L]RewriteCond%{REQUEST_FILENAME}!-fRewriteCond%{REQUEST_FILENAME}!-dRewriteRule./blog/index.php [L]</IfModule> 

请参阅本指南以获取更多信息 https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory >

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}]

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://codex.wordpress.org/Giving_WordPress_Its_Own_Directory