我当前的Wordpress安装位于/var/www/html/mydomain.tld/cms/
,我的WP_SITEURL在wp-config.php中设置为https://mydomain.tld/cms
,WP_HOME设置为https://mydomain.tld
。
在/var/www/html/mydomain.tld/index.php
我require( dirname( __FILE__ ) . '/cms/wp-blog-header.php' );
/var/www/html/mydomain.tld/.htaccess
具有以下代码:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
/var/www/html/mydomain.tld/.htaccess
为空
我的永久链接设置为&#34; day和name&#34;:https://mydomain.tld/2018/06/02/sample-post/
。
目前的行为是,我可以使用https://mydomain.tld
进行浏览,而像https://mydomain.tld/about
这样的网页可以毫无问题地工作。
问题在于我将wordpress安装放在子目录中以确保https://mydomain.tld/wp-admin
将返回404.但是现在它返回302指向https://mydomain.tld/cms/wp-admin
,有效地将任何攻击者重定向到正确的位置
如何配置wordpress和/或Apache2以按预期方式运行?
答案 0 :(得分:0)
如果你有mod_alias,你可以
重定向404 / wp-admin /
就像在那个网址上扔404一样
取自https://webmasters.stackexchange.com/questions/42822/how-to-redirect-specific-url-to-404-in-htaccess
我还没有尝试过。