我的主站点显示 (mypage.com/site),所有后续页面也包括/site 如何实现(mypage.com)没有子目录显示?
我已尝试在 Wordpress 设置中删除站点地址 URL 中的/site。 但它破坏了我的登录并使我无法登录。
我必须怎么做才能删除在我的网站上显示的/site 子目录文件夹?
我在 htaccess 文件中做什么?
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
最佳答案
我假设您的 WordPress 安装在/site 文件夹下。如果是这样,您可以这样做:
如果您已经在常规面板上将 URL 更改为 http://mypage.com (没有/site),你只需要复制index.php
(在site/
下)到根文件夹。
复制index.php文件后,编辑它,将site/
添加到wp-blog-header.php
的路径中:
require( dirname( __FILE__ ) . '/site/wp-blog-header.php' );
此过程的详细步骤在 “使用预先存在的子目录安装 " 在 WordPress 文档:http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
关于php - 主站点在 URL 中显示子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21978931/