Title: change url
Last modified: August 20, 2016

---

# change url

 *  Resolved [cptkirkh](https://wordpress.org/support/users/cptkirkh/)
 * (@cptkirkh)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/change-url-5/)
 * I have setup my wordpress on my own server. The url was as this example test.
   mydomain.com and i switched it to test1.mydomain.com and changed the name in 
   WordPress address (URL) and Site address (URL). I also ran the following sql 
   statements. and yet when i click on a post i get a 404 error directory not found.
   i did not change the location of the files just the url. What else do i need 
   to do? Thanks.
 * UPDATE wp_options SET option_value = replace(option_value, ‘[http://www.old-domain.com&#8217](http://www.old-domain.com&#8217);,‘
   [http://www.new-domain.com&#8217](http://www.new-domain.com&#8217);) WHERE option_name
   = ‘home’ OR option_name = ‘siteurl’;
 * UPDATE wp_posts SET post_content = replace(post_content, ‘[http://www.old-domain.com&#8217](http://www.old-domain.com&#8217);,‘
   [http://www.new-domain.com&#8217](http://www.new-domain.com&#8217););

Viewing 1 replies (of 1 total)

 *  [Drew Jaynes](https://wordpress.org/support/users/drewapicture/)
 * (@drewapicture)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/change-url-5/#post-2270214)
 * Have you already consulted the [Moving WordPress](http://codex.wordpress.org/Moving_WordPress)
   Codex page?
 * Whenever I move a WordPress install, I run 4 sql queries as follows, they might
   provide some help to you.
 *     ```
       UPDATE wp_posts SET post_content = replace(post_content, 'http://domain.com/beta/', 'http://domain.com/anotherfolder/');
       UPDATE wp_posts SET guid = replace(guid, 'http://domain.com/beta/', 'http://domain.com/anotherfolder/');
       UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://domain.com/beta/', 'http://domain.com/anotherfolder/');
       UPDATE wp_options SET option_value = replace(option_value, 'http://domain.com/beta/', 'http://domain.com/anotherfolder/');
       ```
   
 * Hope that helps.

Viewing 1 replies (of 1 total)

The topic ‘change url’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Drew Jaynes](https://wordpress.org/support/users/drewapicture/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/change-url-5/#post-2270214)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
