WordPress wp-admin重定向到http://127.0.0.1/

时间:2016-12-16 19:42:03

标签: wordpress apache .htaccess

我有这个问题:当我尝试登录我的WP仪表板(wp-admin)时,它会重定向到127.0.0.1。

当我输入websitename.com/wp-admin时,显示“无法连接”。

有人可以帮忙吗?

我网站根目录下的.htaccess文件:

# BEGIN All In One WP Security
#AIOWPS_BLOCK_WP_FILE_ACCESS_START
<Files license.txt>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
<Files wp-config-sample.php>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
<Files readme.html>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
#AIOWPS_BLOCK_WP_FILE_ACCESS_END
#AIOWPS_BASIC_HTACCESS_RULES_START
<Files .htaccess>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
ServerSignature Off
LimitRequestBody 10240000
<Files wp-config.php>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
#AIOWPS_BASIC_HTACCESS_RULES_END
#AIOWPS_PINGBACK_HTACCESS_RULES_START
<Files xmlrpc.php>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
#AIOWPS_PINGBACK_HTACCESS_RULES_END
#AIOWPS_DEBUG_LOG_BLOCK_HTACCESS_RULES_START
<Files debug.log>
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</Files>
#AIOWPS_DEBUG_LOG_BLOCK_HTACCESS_RULES_END
#AIOWPS_DISABLE_INDEX_VIEWS_START
Options -Indexes
#AIOWPS_DISABLE_INDEX_VIEWS_END
#AIOWPS_DISABLE_TRACE_TRACK_START
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
#AIOWPS_DISABLE_TRACE_TRACK_END
#AIOWPS_FORBID_PROXY_COMMENTS_START
RewriteCond %{REQUEST_METHOD} ^POST
RewriteCond %{HTTP:VIA} !^$ [OR]
RewriteCond %{HTTP:FORWARDED} !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_HOST} !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$
RewriteRule wp-comments-post\.php - [F]
#AIOWPS_FORBID_PROXY_COMMENTS_END
#AIOWPS_ENABLE_BRUTE_FORCE_PREVENTION_START
RewriteEngine On
RewriteCond %{REQUEST_URI} (wp-admin|wp-login)
RewriteCond %{QUERY_STRING} !(action\=postpass)
RewriteCond %{HTTP_COOKIE} !aiowps_secret= [NC]
RewriteCond %{HTTP_COOKIE} !aiowps_cookie_test_kzs9w240bq= [NC]
RewriteRule .* http://127.0.0.1 [L]
#AIOWPS_ENABLE_BRUTE_FORCE_PREVENTION_END
#AIOWPS_BLOCK_SPAMBOTS_START
<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} ^(.*)?wp-comments-post\.php(.*)$
    RewriteCond %{HTTP_REFERER} !^http(s)?://abc\.com [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule .* http://127.0.0.1 [L]
</IfModule>
#AIOWPS_BLOCK_SPAMBOTS_END
# END All In One WP Security

# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
# DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
# END W3TC Browser Cache
# 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>

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# END WordPress

6 个答案:

答案 0 :(得分:2)

此行适用于您自己的计算机上的开发:RewriteRule .* http://127.0.0.1 [L]

将ip替换为您的域名。

答案 1 :(得分:0)

您似乎正在使用All In One WP安全插件,现在已迁移到公共域。

考虑更新插件的设置。

答案 2 :(得分:0)

将这两行添加到wp-config.php,其中“example.com”是您网站的正确位置。

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

答案 3 :(得分:0)

要解决此问题:

  1. 登录phpmyadmin
  2. 转到wordpress =&gt; wp_option
  3. option_name siteurl 主页编辑 option_value 以更正位置IMG

答案 4 :(得分:0)

websitename.com/wp-admin它显示&#34;无法连接&#34;。

请检查您的网站主题设置 从您的网站中删除WordPress版本元标记。

答案 5 :(得分:-1)

使用此代码可以解决您的问题。我保证。谢谢你的编码很快。

add_filter(&#39; init&#39;,&#34; set_cookie_func&#34;);

function set_cookie_func(){

$ secure =(&#39; https&#39; === parse_url(wp_login_url(),PHP_URL_SCHEME));    setcookie(TEST_COOKIE,&#CR; WP Cookie check&#39;,0,&#39; / nextcore-media-support /&#39;,    COOKIE_DOMAIN,$ secure);    setcookie(&#39; LETMEIN&#39;,&#39; OK&#39;,0,&#39; /&#39;,COOKIE_DOMAIN,$ secure);

if(SITECOOKIEPATH!= COOKIEPATH){

setcookie(TEST_COOKIE,&#39; WP Cookie check&#39;,0,&#39; / nextcore-media-support /&#39;,    COOKIE_DOMAIN,$ secure);    setcookie(&#39; LETMEIN&#39;,&#39; OK&#39;,0,&#39; /&#39;,COOKIE_DOMAIN,$ secure);

}

}