【发布时间】:2017-10-08 03:54:09
【问题描述】:
我通过代理设置了我的 wordpress。我的主站网址是https://DOMAIN/blog
这是为我的代理设置的 apache:
SSLEngine on
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName
SSLProxyCheckPeerExpire off
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /blog/ https://104.xxx.xx.xx/
ProxyPassReverse /blog/ https://104.xxx.xx.xx/
这工作正常。当我转到https://DOMAIN/blog 时,它会将我代理到https://104.xxx.xx.xx,因为它应该
wordpress 的前端实际上运行良好,完全没有问题。
问题出在管理员中,当我转到https://DOMAIN/blog/wp-admin 时。它可以登录,但它会将我重定向到 https://DOMAIN/wp-admin 和 404s(因为 https://DOMAIN/wp-admin 没有被代理)
这是我的 104.xxx.xx.xx 的 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
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>
我尝试过以我能想到的所有方式更改 .htaccess(设置 RewriteBase /blog/,弄乱我的重定向规则,以及其他一千件事)。
感谢您的帮助!
【问题讨论】:
-
您的 RewriteBase 错误。添加您的文件夹。应该是 RewriteBase /blog
-
我试过了,一点用都没有
标签: php wordpress apache .htaccess proxy