I have thought of a similar idea. Then I tried to add the following in wp-config.php and it works.
$hostname = $_SERVER['SERVER_NAME'];
$hostname = str_replace('www.', '', $hostname);
if ($hostname == 'new.net') {
define('WP_SITEURL', 'http://new.net');
define('WP_HOME', 'http://new.net');
}
Oh, forgot to mention. I use domain pointers. Set new.net to point at main.com.
Thanks for reply poppacket.
Please let me know where exactly put the codes? Before and after what line?
I did not understand of the pointer! I put the name servers to point at my host IP and it works fine. The problem is, how to set an add-on domain to show up the posts in main domain.
I would be greatful if you could give me step-by-step insrtuctions about how to set an add-on domain, what to put inside its newly created folder, whst to do about redirecting and so on
Regards
$table_prefix = '3p8e4k_'; // Only numbers, letters, and underscores please!
I PUT THOSE LINES HERE
// Change this to localize WordPress. A corresponding MO file for the
Depending on your control panel, domain pointer also known as domain parkin. If you are using CPanel, you can add the domain in in Parked Domains. Another thing worth of note, it is only possible if your host allow domain parking/domain pointing. Usually its a free feature.
Hi poppacket.
Thanks for your advise but it is not what I wanted. I tried it but it just redirects me to the main site.
I want to get rid of the main domain in addressbar. It is a “must” for me.
I use CPanel, I did as you have said and it was not what I wanted.
Cheers
Yes you can “get rid of the domain in addressbar”.
Have a look at my site:
http://poppacket.com
and http://poppacket.blogrunn.com
It should work unless something went wrong somewhere.
It is fantastic, what was wrong with mine?
Lets say:
1- have old.com
2- buy new.net
3- Add new.net as Parked Domain in old.com
4- Redirect to new.net to old.com/wordpress
5- Put the codes in wp-config.php as described above
6- and, It must be working now..
All I did was the same.
I have to add that my site has many wordpress installed on, different folders (subdomains) and loads of files. All I need to do is to replace old.com with new.net in every thing. I do not want to copy them in a new folder, because I will have to post every thing twice!
I was told that add-on domain will be the best solution, I tried with no victory. I come up with your suggetion, was not successful!
Please tell me what did I do wrong?
regards
Don’t redirect (as per #4). Just add new.com in Parked Domain to old.com.
Domain parking will let you to access any file at old.com using the new.com domain.
e.g.
You have a file: old.com/abcdef.php
You can access this file at new.com/abcdef.php
If you redirect, new.com to old.com/wordpress, it will only redirect new.com/[whatever here] to old.com/wordpress/index.php. That’s the basic idea. So remove redirection. [whatever here] can be anything or even empty.
Good luck.
poppacket thanks, it worked and I found the fault was from my side.
1- Redirection must be disabled, it is done now
2- Parked domain seems to not likeing subdomains
3- Folders are OK but Subdomains goes back to old.com
4- My root index.html was a redirection to yeraly made blog, it was the problem of duble redirection for new.net
5- It is half done
Any idea to how to set subdomains work under new.net?
Regards
If your host allow to have multiple domain, you can do like I show here. I am not so familiar with CPanel. I ditched it long time ago and using DirectAdmin now. But it’s worth trying.
1. Backup all the files in subdomain.old.com (Just in case you lose it)
2. Add subdomain.new.com in Add-on Domains and point it to the directory of subdomain.old.com
Only if that does not work,
3. Delete subdomain.new.com in Add-on Domains
4. Delete subdomain.old.com in Subdomains
5. Add subdomain.old.com in Add-on Domains
4. Add subdomain.new.com in Parked Domains pointing to subdomain.old.com
5. Restore the backedup files earlier to directory of subdomain.old.com.
Again, it will only work if your host allow add-on domains.
thank you vey much, I have done it almost, with your helps ofcorse.
Now, have another issue! There is “permalink” problem on blogs! It seems the code above does not push the wp-config.php to change the address from old.com/niceURL to new.bet/niceURL
I have to use nice URL because my translating software does not like wordpress ID numbers for posts.
Now, evry thing works but the permalinks which makes whole blog useless with new domain. If reader wnats to open a post to read it all, it opens the old.com version.
I tried to play with “Options” in Admin Panel by putting several types of addresses, but it messed whole blog, I had to go to Php MyAdmin to fix it!
Any way, I am glad to have your helps and friendly advises.
Cheers
I am glad that it worked for you, too.
As for the latest problem you encountered, I am not sure what was wrong. If you look at my site, the nice URL work. I use nice URL for permalinks.
Unless you insert a permalink manually (i.e. inserting Link), there shouldn’t be any problem.