sql 更改网站网址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 更改网站网址相关的知识,希望对你有一定的参考价值。

<?php
//Edit wp-config.php
//Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

//This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.
<?php
//When RELOCATE has been defined as true in wp-config.php (see next chapter), the following code in wp-login.php will take action: 
if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
	if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
		$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], , $_SERVER['PHP_SELF'] );

	$url = dirname( set_url_scheme( 'http://' .  $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
	if ( $url != get_option( 'siteurl' ) )
		update_option( 'siteurl', $url );
} 

/*
1. Edit the wp-config.php file.
2. After the "define" statements (just before the comment line that says "That's all, stop editing!"), insert a new line, and type: define('RELOCATE',true);
3. Save your wp-config.php file.
4. Open a web browser and manually point it to wp-login.php on the new server. For example, if your new site is at http://www.yourdomainname.com, then type http://www.yourdomainname.com/wp-login.php into your browser's address bar.
5. Login as per normal.
6. Look in your web browser's address bar to verify that you have, indeed, logged in to the correct server. If this is the case, then in the Admin back-end, navigate to Settings > General and verify that both the address settings are correct. Remember to Save Changes.
7. Once this has been fixed, edit wp-config.php and either completely remove the line that you added (delete the whole line), comment it out (with //) or change the true value to false if you think it's likely you will be relocating again. 
*/
<?php
//Edit functions.php
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );

1.- open the wp_options table. 
2.- edit siteurl and home entryes

以上是关于sql 更改网站网址的主要内容,如果未能解决你的问题,请参考以下文章

如何在卸载前更改我的网站的网址?

如何抓取页面网址未更改但下一个按钮在同一网址页面下方添加数据的网站

更改网址后无法打开 WordPress 网站

如何在 Facebook 应用程序中更改网站网址?

基于网站网址的自定义标签图标

sql 查看所有网站网址