简体   繁体   English

htaccess不会在wordpress中重定向到正确的网站

[英]htaccess doesn't redirect to the right website in wordpress

I decided to switch to a single website to multi-website (called network in wordpress). 我决定将一个网站切换到多网站(在wordpress中称为网络)。 I followed this documentation : 我遵循此文档:
- https://codex.wordpress.org/Create_A_Network -https://codex.wordpress.org/Create_A_Network

First, I followed this documentation 首先,我遵循此文档
- https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory -https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

In order not to have my files in the root of ~/public_html . 为了不让我的文件位于~/public_html的根目录中。 I called the folder : WordPress and I changed my .htaccess. 我将文件夹命名为: WordPress并更改了.htaccess。

At this point everything worked fine. 此时一切正常。

I followed the doc till the end, so I added : 我一直遵循文档直到最后,所以我添加了:

define('WP_ALLOW_MULTISITE', true);

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'mysite.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

And I replaced the old ~/public_html/.htaccess by 然后我将旧的~/public_html/.htaccess替换为

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) WordPress/$1 [L]
RewriteRule ^(.*\.php)$ WordPress/$1 [L]
RewriteRule . index.php [L]

All this code is code that wordpress told me to write. 所有这些代码都是wordpress告诉我编写的代码。

The problem now is that when I go on the main page : mysite.com I see : 现在的问题是,当我进入主页: mysite.com我看到了:

在此处输入图片说明

How I can modify my htacess (or other) to view the main page of the website ? 如何修改我的htacess(或其他)以查看网站的主页?

Thanks 谢谢

edit: this url mysite.com/wp-admin works 编辑:此网址为mysite.com/wp-admin

Multisite is meant to run multiple blogs in the same WordPress install. 多站点旨在在同一WordPress安装中运行多个博客。 Your files should still be in the public_html directory - unless you want your site be accessed via domain.com/WordPress. 您的文件仍应位于public_html目录中-除非您希望通过domain.com/WordPress访问您的网站。

So, all of your files should be directly in public_html. 因此,所有文件都应直接位于public_html中。 Then you can go back to your dashboard and finish setting up Multisite. 然后,您可以返回到仪表板并完成多站点设置。 You can create new websites under Dashboard -> My sites. 您可以在仪表板->我的网站下创建新网站。

If i understand correctly, when you enter mysite.com/WordPress is what you want to appear when you enter mysite.com ? 如果我理解正确的,当你进入mysite.com/WordPress是你想要的,当你进入mysite.com出现什么呢? If yes, then: 如果是,则:

Verify the Profile In your Administration Panels go to Settings > General . 验证配置文件在“管理面板”中,转到“设置”>“常规”。 Here you will verify that the changes you made in Changing the URL above, are correct. 在这里,您将验证在上面的更改URL中所做的更改是正确的。 Verify that the reference in your WordPress Address (URL) contains the new address. 验证WordPress地址(URL)中的引用是否包含新地址。 Verify that the reference in your Site Address (URL) contains the new address. 验证您的站点地址(URL)中的引用是否包含新地址。 If you have made changes, click Save Changes. 如果进行了更改,请单击“保存更改”。

from https://codex.wordpress.org/Changing_The_Site_URL 来自https://codex.wordpress.org/Changing_The_Site_URL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM