[英]Moving WordPress to subdirectory url: wp-admin throws 404
I'm moving my Wordpress blog from a subdomain (where it sits at the moment) to a sudrectory of my root domain. 我将我的Wordpress博客从一个子域(目前位于该域)移到了我的根域的目录中。 So basically it's now in 所以基本上现在
blog.exampledomain.com
And I want it to go to 我希望它去
exampledomain.com/blog
I can move all the content, but wp-admin throws 404 or redirects in the wrong way. 我可以移动所有内容,但是wp-admin会抛出404或以错误的方式重定向。 So I'm not able to manage my blog! 因此,我无法管理我的博客!
The things I've done: 我所做的事情:
Updated the .htaccess as follows: 更新了.htaccess,如下所示:
RewriteEngine On RewriteBase /blog/ RewriteRule ^index.php$ - [L] RewriteBase上的RewriteEngine / blog / RewriteRule ^ index.php $-[L]
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule . RewriteRule。 /index.php [L] /index.php [L]
If I set it like this, the blog itself works but wp-admin throws 404. I also tried an alternative setup of .htaccess I've found around 如果我这样设置,则博客本身可以工作,但wp-admin会抛出404。我还尝试了在.htaccess中找到的另一种设置
#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog.
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
This approach makes it so I'm redirected to 通过这种方法,我被重定向到
exampledomain.com/blog/blog/wp-admin
Which again throws 404! 再次抛出404! I'm stuck now 我现在被卡住了
Additional info not sure if helpful: 其他信息不确定是否有帮助:
You have your siteurl
and home
the wrong way around. 你有你的siteurl
和home
周围走错了路。
siteurl
is where your Wordpress installation is (eg http://exampledomain.com/blog/
). siteurl
是您的Wordpress安装位置(例如http://exampledomain.com/blog/
)。
home
is where the rest of your website is (eg http://exampledomain.com
). home
是您网站其余部分的位置(例如http://exampledomain.com
)。
Changing that should fix it. 更改应该可以解决它。 You can reset your .htaccess file and save your permalink options again to generate a new correct one (only use the multisite one, if you use multisite). 您可以重置.htaccess文件并再次保存您的永久链接选项,以生成一个新的正确的(如果使用多站点,则仅使用多站点)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.