将站点移到子文件夹后,WordPress无法登录到wp-admin

问题描述 投票:0回答:2

我是Wordpress的新手。基本上,我只是想将网站从根www文件夹移动到子文件夹。

我有权访问前端站点,但不能访问管理面板。

我执行了此步骤:

1-将Wordpress地址URL更改为http://example.com/subfolder

2-将所有文件移动到子文件夹,并将index.php和.htaccess复制到根文件夹

3-将index.php代码行更改为require( dirname( __FILE__ ) . '/m4thod.com2/wp-blog-header.php' );

4-.htaccess public_html中,我尝试使用此规则,但我对此进行了评论。

#<IfModule mod_rewrite.c>
#RewriteEngine On
#RewriteCond %{HTTP_HOST} ^(www.)?m4thod.com$
#RewriteRule ^(/)?$ m4thod.com2[L]
#</IfModule>

5-将这行添加到wp-config.php

define('WP_SITEURL', 'http://example.com/subdirectory/');
define('WP_HOME', 'http://example.com/');

define('WP_CONTENT_URL', 'http://example.com/subdirectory/');

我不知道它是否是.htaccess文件,我在public_html和public_html / subfolder中有.htaccess文件

我通常在Magento 2中使用VM中的Apache服务器进行这种迁移,但是我在这种托管和wordpress方面苦苦挣扎。我正在使用Blue Host btw。

更新:我收到Interna错误500。这就是我访问的方式

https://example.com/subdirectory/wp-login.php

问候!

wordpress .htaccess migration subdirectory
2个回答
0
投票

由于不正确的.htaccess而引起冲突。将.htaccess文件放在根文件夹中,并将原始index.php文件复制到子文件夹中。未经编辑require( dirname( __FILE__ ) . '/wp-blog-header.php' );。修改子目录中WordPress网站的.htaccess,以包括子文件夹名称。例如:

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

-1
投票

请更新它的永久链接设置有效吗?

© www.soinside.com 2019 - 2024. All rights reserved.