Tag Archives: domain

Multiple Domains with Single WordPress

This day i did a good work with wordpress multi domain with single wordpress site. I think most of the beginners developers and programmers dont know about  this. But now all guys will know how to do the multi site with single hosting( wordpress ). I would like to show you how to do that.

Ex. if you have two domains. You want to control the all contents with single  back-end for both sites, its possible with wordpress.

First install the wordpress in your primary domain hosting server.

Then Both sites nameserver should be point the primary domain server. Both sites must be point primary site folder(Already you installed wordpress in this location).

Now go to root of the site. Here you can see the wp-config.php. Open the file via ftp or file manager.

Open the file wp-config.php, add the following code :

$_asdfasdf_myurl = ‘http://’.$_SERVER[‘HTTP_HOST’];
define(‘WP_HOME’, $_asdfasdf_myurl);
define(‘WP_SITEURL’, $_asdfasdf_myurl);

We know,  PHP $ SERVER [ HTTP_HOST ]  for obtaining source domain. So,  according to WP_HOME and WP_SITEURL from variable assignment, realize Multiple Domains with Single WordPress.

In order to prevent the picture is not available  caused by the domain name change , you must set ” Options-media-Store uploads in this folder ”  to ”  wp-content / uploads”  ( as ” the default upload path” the same parameters ).

Now primary domain and secondary loads with single wordpress. You can do multiple domain like this way.

If you have any questions let me know. I can help you.

Moving WordPress To A New Domain

Every time I move a WordPress website to a new domain name or url (eg: moving it from a testing site to a live site) I can always count on one thing: my ability to forget the SQL statements to update the urls.

My problem isn’t so much forgetting that I have to do it, but actually forgetting the code itself. Even worse, I haven’t actually documented the code anywhere so I can’t just copy and paste it from somewhere else.

The 3 lines of code really aren’t much to remember, I mean, they are simple and very logical. It’s virtually a find and replace of the old urls to the new urls but for some reason everytime I need it my head just goes blank. Sure I could probably do a find and replace in the SQL dump of the database before the import, but in the past I have faced issues doing it this way for some reason.

For future reference, here is the code:

UPDATE wp_options SET option_value = replace(option_value, ‘THEOLDURL’, ‘THENEWURL’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE wp_posts SET guid = replace(guid, ‘THEOLDURL’,’THENEWURL’); UPDATE wp_posts SET post_content = replace(post_content, ‘THEOLDURL’, ‘THENEWURL’);

It happened again the other day and I’m tired of it, so I decided to do something about it. No, I didn’t memorise the code because well, lets face it, I really should know it already but for some reason it won’t stick. Instead I created a little website which will do it for me. Besides, I figured I can’t be the only person who makes this mistake, so why not help other people out too?

Welcome, Here you simply enter your current WordPress site url (eg: http://localhost) followed by the destination url (eg: http://en.wjd.im) and click the generate button. It then spits out the SQL code you need to run. Easy as pie.

Also, I figured I might as well provide some general instructions on how to manually move, backup or restore a WordPress website, so I added that too. It is all text right now, but I’ll hopefully clean it up, throw in some images and just make it nicer to read overall.

So that’s it, the next time you are migrating a WordPress website, head on over to Moving WordPress and shave that whole 5-10 minutes off your workload. I know I’ll be using it.

Double domain of WordPress

Can WordPress binding double domain?Most people will tell you not,but I have a unique skill to set it,now, follow me!

Suppose you have two domain such as abc.com and efg.com,and then you must open your FTP services.

Open your wordpress dir and find out the file “wp-config.php” and add some code as follow:

$_asdfasdf_myurl = ‘http://’.$_SERVER[‘HTTP_HOST’];

define(‘WP_HOME’, $_asdfasdf_myurl);

define(‘WP_SITEURL’, $_asdfasdf_myurl);


Then,you can also edit the URLs in wordpress data table by run the SQL statement “update TABLENAME  set FIELDNAME = replace (FIELDNAME,’EFG.COM’,’ABC.COM’)”. This statement means replace “ABC.COM” from “EFG.COM” in FIELDNAME , TABLENAME.

Up to this, your wordpress can binding double domain ,now, go and set the Domain !