简体   繁体   English

WordPress网站加载时不带www,除非从其他位置(例如Google搜索)链接时

[英]Wordpress Website loads without www except when linked from elsewhere i.e, from google search

I built a site for a company in Wordpress, www.public-admin.co.uk When you type in the url WITH or WITHOUT the www directly into the address bar, the site loads fine - however, if you are linked to the site without the www which is how its set up in a google search, the site will not redirect and just remains blank. 我在Wordpress中为公司建立了一个网站,www.public-admin.co.uk当您在地址栏中直接输入带有或不带www的网址时,该站点可以正常加载-但是,如果您链​​接到该站点如果没有www(这是它在Google搜索中的设置方式),则该网站将不会重定向,而是保持空白。

The A records seem to be in place ok (otherwise the //public-admin version wouldn't load at all), although the hosting company tells me there needs to be edits to my htaccess file: 尽管托管公司告诉我需要对我的htaccess文件进行编辑,但A记录似乎就位(否则根本不会加载/// public-admin版本):

I can see in some other threads people have added some redirect info to the htaccess file, but not sure if i'm defo on the right track here. 我可以在其他线程中看到人们已经向htaccess文件中添加了一些重定向信息,但不确定我是否在这里正确。

AddHandler application/x-httpd-php70 .php .php5
Options -Indexes
RewriteEngine On
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]


# BEGIN Hide console URL
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^public-admin.co.uk/public-admin-tools/?$ /wp-login.php?CJfSYnpL67maGMJHZr5h [R,L]

RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
RewriteRule ^public-admin.co.uk/public-admin-tools/?$ /wp-login.php?CJfSYnpL67maGMJHZr5h&redirect_to=/wp-admin/ [R,L]

RewriteRule ^public-admin.co.uk/public-admin-tools/?$ /wp-admin/?CJfSYnpL67maGMJHZr5h [R,L]

RewriteCond %{SCRIPT_FILENAME} !^(.*)admin-ajax\.php
RewriteCond %{HTTP_REFERER} !^(.*)public-admin.co.uk/wp-admin
RewriteCond %{HTTP_REFERER} !^(.*)public-admin.co.uk/wp-login\.php
RewriteCond %{HTTP_REFERER} !^(.*)public-admin.co.uk/public-admin-tools
RewriteCond %{QUERY_STRING} !^CJfSYnpL67maGMJHZr5h
RewriteCond %{QUERY_STRING} !^action=logout
RewriteCond %{QUERY_STRING} !^action=rp
RewriteCond %{QUERY_STRING} !^action=postpass
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
RewriteRule ^.*wp-admin/?|^.*wp-login\.php /not_found [R,L]

RewriteCond %{QUERY_STRING} ^loggedout=true
RewriteRule ^.*$ /wp-login.php?CJfSYnpL67maGMJHZr5h [R,L]
</IfModule>
# END Hide console URL

Problem turned out to be a potentially corrupted htaccess file - inside wordpress i just needed to generate a new one inside the permalinks tab and this solved the issue. 问题原来是一个可能损坏的htaccess文件-在wordpress中,我只需要在permalinks选项卡中生成一个新文件,就可以解决此问题。

This video is where I found the instructions FWIW. 该视频是我在FWIW上找到说明的地方。

https://www.elegantthemes.com/blog/tips-tricks/how-to-fix-the-500-internal-server-error-on-your-wordpress-website https://www.elegantthemes.com/blog/tips-tricks/how-to-fix-the-500-internal-server-error-on-your-wordpress-website

THank you 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM