如何在Laravel公用文件夹中安装Wordpress [英] How to install wordpress in laravel public folder

查看:92
本文介绍了如何在Laravel公用文件夹中安装Wordpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也点击此链接,但这不是我的解决方案- laravel和wordpress在同一域中(laravel在子文件夹中)
我想在我的laravel网站上添加wordpress.
所以我将所有的wordpress安装在laravel的公共文件夹中.在这里,我创建一个文件夹"blog",并在此文件夹中安装我的wordpress网站.

但是我的问题是,当我像本地主机:8000/blog这样运行我的wordpress网站时,它运行得很好

但是当我尝试操作另一个链接时,laravel重定向到我的404页面未找到.

因此,如果对任何文件进行任何更改,如何在laravel中运行wordpress,所以请任何人帮助我.

我的laravel公用文件夹的.htaccess像这样

 < IfModule mod_rewrite.c>< IfModule mod_negotiation.c>选项-MultiViews</IfModule>RewriteEngine开#如果不是文件夹,则重定向尾部斜杠...RewriteCond%{REQUEST_FILENAME}!-dRewriteRule ^(.*)/$/$ 1 [L,R = 301]#处理前控制器...RewriteCond%{REQUEST_FILENAME}!-dRewriteCond%{REQUEST_FILENAME}!-fRewriteRule ^ index.php [L]#处理授权标头RewriteCond%{HTTP:Authorization}.RewriteRule.*-[E = HTTP_AUTHORIZATION:%{HTTP:Authorization}] 

解决方案

要将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

这篇关于如何在Laravel公用文件夹中安装Wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆