The MU forums have moved to WordPress.org

How to make subdomain work with blog? (22 posts)

  1. Cruz
    Member
    Posted 17 years ago #

    Looks like amount of posts were erased. I need your help in making regular subdomain working with mu blogs. Currently, if I go to the domain name I setup from hosting control panel, it shows:

    Fatal Error
    Could Not Find Blog!

    Few weeks ago some of you gave me advice of moving the wildcard dns entry to the last. I did that and am still facing the same issue. Can you please help me? I may have missed something else to make it work?

    Thank you.

  2. Cruz
    Member
    Posted 17 years ago #

    Can someone help me with this?

  3. andrewbillits
    Member
    Posted 17 years ago #

    If you've moved the wildcard entry to last and it's still not working try adding a .htaccess file to the subdomain in question root folder with the following:

    "rewriteengine off"

  4. Cruz
    Member
    Posted 17 years ago #

    Thank you Andrewbillits,
    I will try it out!

  5. Cruz
    Member
    Posted 17 years ago #

    By adding "rewriteengine off", that would disable currently working subdomain blogs to stop functioning right?

    I must have mislead you with poor description. I have blogs working with subdomain such as http://user.blog.com. What changes should I make so that some specific subdomains are not controlled by wordpress MU?

    For example, the username support is banned for signup because I like to use http://support.blog.com as a separate subdomain that I can use for other purposes.

  6. pumpkinslayer
    Member
    Posted 17 years ago #

    Create a "real" subdomain then make your .htaccess for wpmu look like this

    RewriteEngine On
    RewriteBase /
    
    # Rewrite http://www.domain.com to domain.com
    RewriteCond %{HTTP_HOST} ^www.(.*)
    RewriteRule ^(.*)       http://%1/$1 [R,L]
    
    # Rewrite support.blog.com to the right place
    RewriteCond %{HTTP_HOST} support.blog.com
    RewriteCond %{REQUEST_URI} !support/
    RewriteRule ^(.*)$ support/$1 [L]
    
    #uploaded files
    RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
    RewriteRule . index.php [L]
  7. Cruz
    Member
    Posted 17 years ago #

    Thank you Pumpkinslayer! I'm trying this out!

  8. Ovidiu
    Member
    Posted 17 years ago #

    worked for me :-) thx a lot

  9. ealm
    Member
    Posted 17 years ago #

    pumpkinslayer: The .htaccess-file that was created automatically, during installation, looks exactly like that. Still I don't get subdomains working (my host has set the subdomain wildcards for DNS and Apache for me, and I got no errors during wpmu-setup).

    What can I do?

  10. Ovidiu
    Member
    Posted 17 years ago #

    I am not sure the advice given here, really suits the problem stated in the first post, I personnaly used this info to take a certain subdomain out of wpmus administration so to expand this example:

    I created a real subdomain support.blog.com, then put these 4 lines into my .htaccess

    # Rewrite support.blog.com to the right place
    RewriteCond %{HTTP_HOST} support.blog.com
    RewriteCond %{REQUEST_URI} !support/
    RewriteRule ^(.*)$ support/$1 [L]

    this will take the support subdomain out of wpmu's administration and in combination of a folder inside your root called support it will work.
    result => if you visit support.blog.com you see the content of the folder support not a subdomain handled by wpmu - hope this clarifies things a little

  11. Cruz
    Member
    Posted 17 years ago #

    That is very clear Ovidiu, Thank you =)

  12. Cruz
    Member
    Posted 17 years ago #

    1. I created subdomain
    2. Added the 4 lines in .htaccess, but strangely the site is directing me to
    http:/blog.com/wp-signup.php?new=support

    Hum, any ideas?

  13. Ovidiu
    Member
    Posted 17 years ago #

    I forgot a tiny piece of information:

    you have to add this real subdomain to the list of Banned Names inside your wpmu options

    in the backend => site admin => options => Banned Names: "enter your real subdomains name here"

  14. Cruz
    Member
    Posted 17 years ago #

    I actually had the name support banned as the name users can sign up for. Hum.. This is strange.

  15. Ovidiu
    Member
    Posted 17 years ago #

    you said:

    1. I created subdomain
    you set it up on your DNS server? with an A-record? and its still handled by wpmu? ypu have a folder by that subdomains name in your root?

    just double checking

  16. drmike
    Member
    Posted 17 years ago #

    I actually had the name support banned as the name users can sign up for.

    You should have it in there actually. We had a list. Probably should have that up in the trac someday...

  17. Cruz
    Member
    Posted 17 years ago #

    "you set it up on your DNS server? with an A-record? and its still handled by wpmu? ypu have a folder by that subdomains name in your root?"

    Ahh. I created the subdomain via Cpanel. Do I need the host to do other setting?

    Yes, there is a folder at the root.

  18. Ovidiu
    Member
    Posted 17 years ago #

    no, setting up via any control panel should do the same as I suggested...
    I am sorry but I am at a loss here... maybe you wait for another hint from drmike ? sorry

    ###edit###
    had another idea:

    you said:

    2. Added the 4 lines in .htaccess, but strangely the site is directing me to
    http:/blog.com/wp-signup.php?new=support

    this means the .htaccess does not work - can you post the 4 lines you added? and maybe post the line before and the one after, so we can see where you inserted it...

  19. Cruz
    Member
    Posted 17 years ago #

    Hello!
    I like to report that after uploading .htaccess again, it is now working! Thank you so much Ovidiu, Drmike and pumpkinslayer for guiding me through this!

  20. gravesend46
    Member
    Posted 17 years ago #

    Hi guys, maybe you can help me out with identical problem. None of my non-WPMU subdomains worked and host has set up wildcard DNS, etc.

    My .htaccess file now looks like this:

    RewriteEngine On
    RewriteBase /blogs/

    # Rewrite http://www.mydomainname.com to domainname.com
    RewriteCond %{HTTP_HOST} ^www\.(.*)
    RewriteRule ^(.*) http://%1/$1 [R,L]

    # Rewrite testsite.mydomainname.com to the right place
    RewriteCond %{HTTP_HOST} testsite.mydomainname.com
    RewriteCond %{REQUEST_URI} !testsite/
    RewriteRule ^(.*)$ testsite/$1 [L]

    #uploaded files
    RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Anyone suggest where I'm going wrong?

  21. lunabyte
    Member
    Posted 17 years ago #

    You're in a sub directory. Unless the directory for "whatever" is located there and mapped to a directory there, it won't work. If the directory that contains the directory for the sub domain files is above /blogs/, then you don't even need to worry about it.

    If it's in the /blogs/ directory and mapped as such (through apache's conf file) then stick the condition for the subdomain after "RewriteBase /blogs/", but before the www rewrite rule.

    Then if you want to strip the www, you can do that in the htaccess file in the directory with the subdomain files.

  22. humbl
    Member
    Posted 16 years ago #

    I have this problem, new users subdomains are not being created. when they click on a link in the email to be taken to their blog there is a not found error returned. I am on godaddy hosting and using latest release. Not a programmer, so please be very clear about what i should do. thanks peops

About this Topic