0
我知道这个问题经常出现,但没有一个答案令我满意。我试着在网络上找到的所有东西都没有用。404当WordPress在子文件夹中
1 - 我安装我的WordPress的子文件夹/folder/wp
。
2 - I移动.htaccess
和index.php
到根(由WordPress给出)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /folder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /folder/index.php [L]
</IfModule>
# END WordPress
3 - I改变index.php
这样的:
/** Loads the WordPress Environment and Template */
require(dirname(__FILE__) . '/wp/wp-blog-header.php');
4 - 我改变WordPress的网址:http://localhost/folder/wp
5 - 我保留网站地址:http://localhost/folder
没有固定链接,一切正常。 当我打开永久链接,我有一个404
有一些事情我不明白:
1 - 为什么要保持在子文件夹index.php
和.htaccess
?
2 - 有人说要在RewriteBase和RewriteRule中加/wp
在.htaccess
的根,但是不会改变?
我读了几十个帖子,没有为我工作。有没有人遇到过这个问题?
感谢你,因为不被认为是确保了Apache的mod_rewrite模块启用非常
请注意物品编号7在'CODEX'说明在这里https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory它说,你需要复制不移动你的'.htaccess'和'index.php'(你的项目2上面)。 – DaveCoast
我看到了,它完成了。但WordPress永远不会改变子文件夹中的.htaccess,所以永远是空的。 –
是否启用重写模块?你有没有添加 AllowOverride All 允许从所有 到虚拟主机? –