简体   繁体   English

使用htaccess通过子目录中的特定URL路径加载wordpress

[英]Load wordpress through specific URL path from subdirectory using htaccess

The goal 目标

Visting www.DOMAIN.com/blog to load Wordpress from a directory named "/wp-blog" or similar. 前往www.DOMAIN.com/blog以从名为“ / wp-blog”或类似目录的目录加载Wordpress。 Also another rule is the host must match a specific domain. 另一个规则是主机必须匹配特定的域。

Current rules 当前规则

This does not seem to be working: 这似乎并不奏效:

RewriteCond %{REQUEST_URI} ^blog [NC]
RewriteCond %{HTTP_HOST} ^(www.)?DOMAIN.com$
RewriteRule ^(/)?$ wp-blog [PT,L]

Any ideas what we're doing wrong? 任何想法我们在做什么错?

The fix was actually simple 解决方法实际上很简单

The rules just needed altering slightly and I had to actually change the /blog directory name as some other rules were causing apache to get confused. 这些规则仅需稍作更改,而我不得不实际更改/ blog目录名,因为其他一些规则使apache感到困惑。

RewriteCond %{REQUEST_URI} ^/blog [NC]
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteRule ^blog(/.*)?$ /wp_blog/$1 [L]

Also had to update htaccess for the Wordpress install as well to reference wp_blog 还必须为Wordpress安装更新htaccess并参考wp_blog

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

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