WordPress.org

Ready to get started?Download WordPress

Forums

A very complex or simple?: One WordPress with many domains (2 posts)

  1. diggim8
    Member
    Posted 6 months ago #

    Somehow the modern book of answers (google) failed me for the very first time, i will come back to why in a sec.

    MY STORY:
    It first started with an opportunity given to me, some guys needed help with their wordpress site.
    Sure I make websites in wordpress and know some basic html & css but nothing too advanced but OK i said! no problemos.

    Ususally, your own problem has already been someone else problem before it was a problem for you. (i thought)

    So .. I’ll google it!

    After some intense research a friend calls me and I’ll decide to ask my friend for a solution.

    I tell him:
    I got this really complex problem. I need different domains on each post category for my blog!:S

    He tells me:
    - LOL thats really easy! You just go to permalinks and pick a name for each category! xD

    My answer:
    .... ehm. -.-

    MY SITUATION:
    - I have one primary domain (w~w.awsomeblog.com)
    - and 3 more domains. (w~w.superman.com) (w~w.batman.com) (w~w.peter-griffin.com)
    - One wordpress installation (newest).
    - 3 post-categories containing articles (posts)
    - Pretty permalinks

    I use the blog for writing superman, batman and peter-griffin articles ,
    (as 3 post-categories)

    w~w.awsomeblog.com/superman/article
    w~w.awsomeblog.com/batman/article
    w~w.awsomeblog.com/petergriffin/article

    But I wanna make use of my domains
    (w~w.superman.com) (w~w.batman.com) (w~w.peter-griffin.com)

    w~w.superman.com/article instead of w~w.awsomeblog.com/superman/article etc etc

    Having domains for each category, working prettylinks and NOT using multisite, I told my friend.

    Beacuse when I did my google research the resluts get mixed up with setup multisites with different domains - in my case there is a single WP installation (not multisite).

    My friends answer: GL HF

    SO MY QUESTION TO YOU:
    I did understand I could make use of .htacess and I also read some about redrict / rewrite but its not really clear.

    1. What solution fits my problem? (i need to keep pretty permalinks)
    2. How to point the other domains? if I have the domains at same hosting company as WP install
    3. How to point the other domains? if I have domains at other regstar.

    I am very muchos grande appreciated for your very assistance in this matter!

    PS: sorry to dissapoint but im not really writing a superman blog.

  2. bcworkz
    Member
    Posted 6 months ago #

    It should not matter who your domain registrar is, you alter the domain's DNS record to point to your actual server. If you cannot do this you need to move your domains to a legitimate registrar as soon as you can.

    How to alter your DNS record would depend on your registrar. First determine from your host what the proper IP address is for your server. Log into your domain account and find something about editing DNS Zone File. Edit the 'A' record to point to your server IP. Depending on the TTL setting, traffic to your domain should be soon directed to your server.

    If your host is also your registrar, everything should be setup for you, but you could look at your zone file to confirm the A record is correct.

    You can rewrite URLs in .htaccess, but this may not work well for you. Since you are changing domains and not just server paths, the rewrite appears in the user's browser and the status is returned as 302 instead of 200. At least I think so. You might do a test to be sure because this would otherwise be an easy solution.

    The Rewrite API will not be of much use because it only deals with the request string which does not include the domain portion. As far as accessing posts, you don't really need the category argument anyway, the slug alone will retrieve the post. The issue is more for category queries which should appear to the user as a home page for superman or whomever. In this case use the 'pre_get_posts' action to extract the category from the domain contained in $_SERVER['HTTP_HOST'] and set the 'category_name' query var.

    There may be all sorts of other issues, but this takes care of at least the basics. Resolve each issue when encountered and you should get it all working eventually.

Reply

You must log in to post.

About this Topic