WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Site aliases from within WP 3.0 (26 posts)

  1. davidem
    Member
    Posted 4 years ago #

    Hi all,

    I just migrated to WP 3.0 and immediately wanted to make work of the multisite options. Everything works fine, I just have a question:

    Is it possible to create subdomain aliases in wordpress? For example, I have the following setup:

    main domain: domain.com
    site1: site1.domain.com
    site2: site2.domain.com

    I would like to point 'whatever.domain.com' to site1.domain.com, which I used to do with a simple serveralias in apache. But that has been replaced by the wildcard ;) Do I have to tinker with the always amazing apache rewrite rules, or does anyone know a more simple solution, preferably from within WP?

    Thanks,

    David

    /edit:
    I found out that to make an 'alias' which points to the main domain, you should simply put the name in the 'Banned Names' in SuperAdmin > Options.

  2. If you put a defined subdomain in your httpd.conf file, it should supersede the wildcard.

    So if you define foo.domain.com, then that will take precedence over *.domain.com

    Is that what you mean?

  3. Mark / t31os
    Moderator
    Posted 4 years ago #

  4. davidem
    Member
    Posted 4 years ago #

    Hi Mark & ipstenu,

    I already have the wildcard setup in my httpd.conf, but since I did that, it is no longer possible to create ServerAliases for specific subdomains created in WordPress.

    If I do create a ServerAlias in httpd.conf, it would only make it point to the general domain / main WP domain which I called 'domain.com' in my example.

    Another possibility would be using mod_rewrite in httpd.conf to 'translate' the alias in an existing subdomain, but that isn't the most easy option and is not an option for my customers, as they can't edit httpd.conf.

    That's why I'm asking if it is possible to create aliases from within WP.

  5. I already have the wildcard setup in my httpd.conf, but since I did that, it is no longer possible to create ServerAliases for specific subdomains created in WordPress.

    Well right, you're talking using the wildcard for all WordPress subdomains and manually created aliases for NON WordPress domains.

  6. davidem
    Member
    Posted 4 years ago #

    Well, no, because non-WP domains/subdomains I can catch with separate VirtualHosts in Apache... I'm talking about aliases for subdomains created in WP.

    To put is simple: I want blaat.domain.com and blabla.domain.com to go to the same WP site. How do I do that with WP3.0 and without Apache redirects, preferably within WP itself?

  7. Wait ... I think I understand what you want:

    Do I have this scenario correct?

    WordPress installed at domain.com
    SubSite Foo at foo.domain.com
    ALIAS for Foo (Bar) is bar.domain.com

    foo.domain.com is handled by the wildcard.

    You want bar.domain.com to point foo.domain.com which doesn't actually exist because it's a wildcard?

  8. davidem
    Member
    Posted 4 years ago #

    Yep, that's indeed what I want ;)

    /edit: just a side-question: was my initial quesion that cryptic? If so, I need to work on my ehm... explaining skills ;)

  9. Not on a re-read, but ... I think since most of us are used to hearing the other question, we didn't think. That's my excuse!

    I would say DON'T use the wildcard for that domain, and instead specify that foo.domain.com points to domain.com (which SHOULD still let WP handle it) and then point bar.domain.com to foo.domain.com?

    But I'm not 100% sure that would work. You may need to look up how to point server aliases to other aliases :/ I almost want to say it's more an apache issue than an WP one.

  10. I almost want to say it's more an apache issue than an WP one.

    It is.

    I don't think it's possible myself. Definitely not in the backend of WP.

  11. davidem
    Member
    Posted 4 years ago #

    hmm, too bad... Because for me it is not a problem to tinker with Apache's files, but it is for the people who will use these blogs eventually.

    What's the chance that it will end up in a future release? ;)

  12. Seeing as it's sort of a function of how any web app would react to that situation, I'm not sure that WordPress could fix it. Any fix for Apache would likely break on IIS.

  13. davidem
    Member
    Posted 4 years ago #

    To be honest I don't agree with the conclusion that it is an issue with Apache. Apache works fine and is set up correct, according to the setup guide from WordPress.

    The wildcard in httpd.conf sends all subdomain-requests to WordPress, so it is up to WordPress to interpret those requests. At this moment, if it doesn't recognize a subdomain, it asks if a new site should be created. It shouldn't be that difficult to make it understand aliases.

    And as I stated before, it already works if you want an alias for your main domain, by just make an entry in the 'Banned Names' section of the superadmin options.

  14. And as I stated before, it already works if you want an alias for your main domain, by just make an entry in the 'Banned Names' section of the superadmin options.

    Somehow I missed that. o.O

    The problem there is WP isn't saying banneddomain = subdomain2, it just says 'Any domain here isn't allowed to be a subdomain goes back to main.'

    Maybe you could code up an aliases plugin that says 'Sub1 = sub2'? I know I can do that in cPanel, which is my workaround for this.

  15. davidem
    Member
    Posted 4 years ago #

    Maybe you could code up an aliases plugin that says 'Sub1 = sub2'?

    Lol... Let's have a look at 'Hello Dolly' ;)

  16. It would be similar to the banned name check, just instead of defaulting to main, it would allow you to chose (say from a dropdown of defined subdomains)?

    That would actually be pretty awesome. Certainly plugin territory, since I don't know why most people would want to do this. Why do you, out of curiosity?

  17. davidem
    Member
    Posted 4 years ago #

    Someone asked me to set up a WP multisite installation, after I explained the new features of WP3.0, and asked me if he could simply create aliases. And as I don't want to be called every now and then with the question if I can configure Apache again, I was wondering if WP could deal with such a thing.

    I don't have a lot of spare time, but I'll have a go at my first plugin ;)

  18. I suppose I'd ask back 'Why do you want to have aliases?' That's the sort of odd-ball request I dig into, since generally I've found them to be the 'wrong answer' to a question they're asking oddly!

    I've got this on a 'to do list' too, in case I get free time in the next couple weeks. :)

  19. davidem
    Member
    Posted 4 years ago #

    OMG... It was right under my nose. Remember the "WordPress MU Domain Mapping" plugin you're suggested to install during setup of WP3.0 Multisite? Well, I always thought it was mainly meant to deal with multiple domains, but...

    ... It also works like a charm for sub-domains! If you're at the 'domains' page, simply fill in the blog-id of for example foo.domain.com in the 'Site ID' field, and type bar.domain.com in the 'Domain' field, uncheck primary and: tadaa... it works! bar.domain.com brings you directly to foo.domain.com!

  20. Oooh the joke'll be on Andrea_r when she gets back! :) Heh. She'll like this!

  21. davidem
    Member
    Posted 4 years ago #

    I remember something like 'definitely not'... ;)

    Anyway, thanks for all the feedback, it kept the topic warm... Otherwise I probably had already forgotten that I needed to figure this out...

  22. Arguably it's NOT the backend of WordPress. I'm calling this a hidden feature ;)

  23. davidem
    Member
    Posted 4 years ago #

    On the other hand, Andrea_r seems to be very close to wpmuguru, one of the authors of the plugin ;)

  24. Oh good LORD. *that's* what you meant??? *headesk*

    :D LOL

    And yes, wpmuguru and I are considered pretty close. ;)

  25. mavendev
    Member
    Posted 3 years ago #

    well this might help you ... now and in future too

    I came across a situation, Everything was fine … wordpress 3.0 was installed properly but i was unable to create sub domain for wordpress for example :

    * wordpress.mavendeveloper.com or
    * jobs.mavendeveloper.com or
    * extjs.mavendeveloper.com or
    * iphone.mavendeveloper.com or any other such sub domain under wordpress 3.0

    I searched in forums for help … and followed each and everything like :

    * DNS alias (* )
    * created Network :

    To enable the Network menu item, you must first define multisite in the wp-config.php file.

    Open up wp-config.php and add this line above where it says /* That's all, stop editing! Happy blogging. */:

    define('WP_ALLOW_MULTISITE', true);

    * even changed in Database

    But no hope …. after that what i did is :

    * removed/deactivated all the active plugins
    * uploaded twentyTen theme (it comes by default)

    And Yes , After i uploaded twentyTen Theme it worked … i have just removed this theme and has just my custom theme … and that was the solution …..

    Please do Upload TwentyTen theme if u come up with such a problem and you will find it working ….

    If you have any problem in sub-domain issue please write to me …. i have gained a whole lot of experience in sub-domain issue for wpmuwordpress 3.0 and ….

    see http://www.mavendeveloper.com for more details

  26. davidem
    Member
    Posted 3 years ago #

    @mavendev: Creating subdomains and using them wasn't the issue, but thanks for the reply ;)

Topic Closed

This topic has been closed to new replies.

About this Topic