Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Linux Apache2 Wordpress核心位于子目录中,但没有重定向到wp admin_Php_Wordpress_Apache_.htaccess - Fatal编程技术网

Php Linux Apache2 Wordpress核心位于子目录中,但没有重定向到wp admin

Php Linux Apache2 Wordpress核心位于子目录中,但没有重定向到wp admin,php,wordpress,apache,.htaccess,Php,Wordpress,Apache,.htaccess,我当前的Wordpress安装位于/var/www/html/mydomain.tld/cms/,我的WP\u站点URL设置为https://mydomain.tld/cms和WP_HOME tohttps://mydomain.tld在wp-config.php中 在/var/www/html/mydomain.tld/index.php中,我有require(dirname(_文件).'/cms/wp blog header.php') /var/www/html/mydomain.tld/

我当前的Wordpress安装位于
/var/www/html/mydomain.tld/cms/
,我的WP\u站点URL设置为
https://mydomain.tld/cms
和WP_HOME to
https://mydomain.tld
在wp-config.php中

/var/www/html/mydomain.tld/index.php
中,我有
require(dirname(_文件).'/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
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
/var/www/html/mydomain.tld/.htaccess
为空。
我的永久链接设置为“日期和名称”:
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以达到预期的效果?

如果您有mod_alias,您可以

重定向404/wp管理/

就像在那个url上抛出404一样

取自


我还没有尝试过。

添加
重定向404/wp admin
重定向404/wp login.php
到.htaccess的结尾,该站点运行正常!非常感谢你。