我已经在WordPress上创建了我的CMS,并通过wp向世界公开了它。
我对此有些怀疑。请帮助找出以下查询的解决方案。
这是我写的.htaccess示例
ErrorDocument 401 /blog.example.local/index.php?error=404
ErrorDocument 403 /blog.example.local/index.php?error=404
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)?/wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?/wp-admin$
RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
RewriteRule ^(.*)$ - [L,R=403]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(.*)?/wp-json(.*)$
#RewriteRule ^(.*)$ $1 [L]
RewriteRule ^(.*)$ https://www.example.local/blog/$1 [R=301,L]
</IfModule>
<files wp-config.php>
order allow,deny
Require all denied
</files>所有内容都托管在Linux服务器(AWS EC2实例)和Apache服务器上。
发布于 2016-10-03 06:24:40
我等了很久才得到这个问题的答案,但仍然没有得到任何回应。因此,我开始修改.htaccess文件并读取所有Apache重写规则。
最后,我成功地得到了答案,这对我来说是很好的。我在这里张贴答案,以便任何人都可以得到参考,如果他们将在未来的问题。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin(.*)$
RewriteCond %{REMOTE_ADDR} ^127.0.0.1$
RewriteRule ^(.*)$ $1 [QSA,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} ^(.*)?wp-json(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ $1 [QSA,L]
RewriteRule . /index.php [L]
RewriteCond %{REQUEST_URI} !^(.*)?wp-login\.php(.*)$
RewriteCond %{REQUEST_URI} !^(.*)?wp-admin(.*)$
RewriteCond %{REQUEST_URI} !^(.*)?wp-json(.*)$
RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
RewriteRule ^(.*)$ https://www.example.com/blog/$1 [R=301,L]
</IfModule>
<files wp-config.php>
order allow,deny
Require all denied
</files>https://stackoverflow.com/questions/39775885
复制相似问题