简体   繁体   English

我的wordpress网站重定向到http://0.0.0.0/postname

[英]My wordpress site redirects to http://0.0.0.0/postname

I am very new to Wordpress but was given a task to retrieve WP driven website. 我是Wordpress的新手,但却被赋予了检索WP驱动网站的任务。

At first I worked on localhost and managed to fix it - the only thing that did not work was the custom permalink (set to 'postname'). 起初我在localhost上工作并设法修复它 - 唯一不起作用的是自定义永久链接(设置为'postname')。 The site only works good locally if permalinks are set to 'default'. 如果永久链接设置为“默认”,则该站点仅在本地运行良好。

Anyway, I decided to put the site to test on server. 无论如何,我决定把网站在服务器上测试。 I only managed to view main site - and only when permalinks are set back to 'postname'. 我只设法查看主站点 - 并且只有当永久链接被设置回'postname'时。 All other sites redirect me to http://0.0.0.0/postname and give me 'ERR_ADDRESS_INVALID'... However when I manually enter eg http://mysite/?page_id=1 it appears just ok... It made me really confused. 所有其他网站都将我重定向到http://0.0.0.0/postname并给我'ERR_ADDRESS_INVALID'...但是当我手动输入例如http:// mysite /?page_id = 1时,它似乎没问题...它让我真的很困惑。

WP-admin works ok. WP-admin工作正常。

My .htaccess file is standard: 我的.htaccess文件是标准的:

`<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>`

Have you got any suggestions? 你有什么建议吗?

In the "wp_options" table are two options which need to be changed. 在“wp_options”表中有两个需要更改的选项。 "home" and "site" have to be set to your new domain: 必须将“home”和“site”设置为您的新域名:

I attached an image for clarification 我附上一张图片以便澄清

First of all, just make sure that Mod_rewrite enabled on your server check this answer ! 首先,只需确保在您的服务器上启用Mod_rewrite检查此答案

And the solution for the redirection to this http://0.0.0.0/postname is to update site url and home url at the database there's 2 ways for this. 重定向到此http://0.0.0.0/postname的解决方案是更新站点URL和数据库的主URL,有两种方法。

  1. If you have access for phpmyadmin, you can go to "wp_options" table and update "siteurl" and "home" with your new domain. 如果您有访问phpmyadmin的权限,则可以转到“wp_options”表并使用新域更新“siteurl”和“home”。
  2. Update it through wp-config.php at the root folder of your project. 通过项目根文件夹中的wp-config.php更新它。 define( 'WP_SITEURL', 'http://your.domain' ); and define( 'WP_HOME', 'http://your.domain' ); define( 'WP_HOME', 'http://your.domain' );

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

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