【问题标题】:Giving WordPress Its Own Directory when root is redirected to subfolder将根目录重定向到子文件夹时为 WordPress 提供自己的目录
【发布时间】:2016-06-15 09:54:38
【问题描述】:

所以我在网络服务器上设置了一个 WP 站点,使用子文件夹作为主页的根目录,但我无法让它工作。真正的根被锁定,所以我无法访问。

原始的.htaccess & index.html 文件位于ftp://ftp.example//web/ 我想在ftp://ftp.example//web/wp 中安装我的 WP。

首先我将 WP 中的常规设置更改为:

WordPress 地址(URL):http://www.example.com/wp

网站地址(URL):http://www.example.com

然后我将 index.php 和 htaccess 复制到 ftp://einstein.netureza.pt//web/ 将 index.php 中的第 17 行 更改为 require( dirname( __FILE__ ) . 'wp/wp-blog-header.php' );更新了 wp-admin 中的永久链接

.htaccess 现在说:

## Default .htaccess file

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

# END WordPress

当我转到我的网址 http://www.example.com 时,我得到了这个错误:

The strategy4change.eu page isn’t working

strategy4change.eu is currently unable to handle this request.
HTTP ERROR 500

但是,访问http://www.example.com/wp 有效。

【问题讨论】:

    标签: php wordpress .htaccess subdirectory document-root


    【解决方案1】:

    我没有足够的声望来发表评论。但我希望这是一个有效的答案:

    你错过了一个正斜杠:

    require( __DIR__ . '/wp/wp-blog-header.php' );
    

    【讨论】:

    • 哦,天哪,这只是经典的 ;) 干杯。
    猜你喜欢
    • 1970-01-01
    • 2011-09-17
    • 2017-01-29
    • 2021-09-03
    • 2011-01-19
    • 2012-10-23
    • 1970-01-01
    • 2011-01-14
    相关资源
    最近更新 更多