WordPress.org

Ready to get started?Download WordPress

Forums

Subdomain to Page (3 posts)

  1. misheff
    Member
    Posted 5 years ago #

    How can I turn pages in subdomains?
    I found a plugin that turns categories into subdomains!

    I want the same effect with Pages.

    Example: I have page (website.com/about) and i want to turn this url into: about.website.com How to do this?

    I use WordPress 2.6.2 Please help me!

  2. jjh35
    Member
    Posted 5 years ago #

    i'm looking for something along these lines as well.. just so that user registrations traverse all the subdomains im planning to setup.. so hopefully someone responds

  3. wmrom
    Member
    Posted 5 years ago #

    Here's the solution I used (this only works if: 1, your subdomains are run out of subdirectories of the directory in which wordpress is installed; and 2, your permalink settings are set to default (i.e. http://www.somesite.com/?p=123)):

    create a file named index.php in the subdomain's directory. In that index.php file, paste all of the code from wordpress' main index.php file and make the following modifications:

    before any other code (before the line that starts with 'define'), add
    $_GET['page_id']=XXX;
    where XXX is the page_id of the page you want the subdomain to show (if you don't know it, go to the page while permalinks are set to default and it'll be in the url). This defines the page in the script without having it in the url

    Then, where it says
    require('./wp-blog-header.php');
    add one more period at the beginning of the filepath so it looks like this:
    require('../wp-blog-header.php');

    This tells it to load the wordpress environment, and tells it that it will find the file one directory up (rather than the normal "in the same directory" location).
    The advantage of this method is that it actually runs the same wordpress installation that your main site does, so it's a lot easier to manage. Any changes to the blog will immediately take effect in the subdomains as well. The only downsides I've come across so far are: 1: user info does not persist between subdomains and the main site, which means users would have to log in each time they go to a new subdomain; and 2: It's difficult to get widgets, etc. to link to the subdomain rather than just the page (the only way I've found is to manually go into the code and write extensive "if" statements telling it how to display some links).

Topic Closed

This topic has been closed to new replies.

About this Topic