Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

This is a discussion on Redirect subdomain to multihosted domain name? in the Shared & Semi-Dedicated forum
I have a subdomain. Recently I registered a domain name and I'm using it as a multihosted domain on my account. If someone enters the ...

  1. #1
    Loyal Client
    Join Date
    May 2002
    Location
    Wisconsin, USA
    Posts
    568

    Redirect subdomain to multihosted domain name?

    I have a subdomain. Recently I registered a domain name and I'm using it as a multihosted domain on my account.

    If someone enters the site by going to subdomain.mydomain.com, is there something I can do so the new domain name will appear in the address bar, instead of the subdomain?

    Some command I can enter in the htaccess file maybe?

  2. #2
    Like a star... Julian Muņoz's Avatar
    Join Date
    Oct 2002
    Location
    Colombia
    Posts
    1,399
    I was wondering the same thing, and I remember a long long time ago, someone posted it on an aletia page.

    It's old, and I haven't tested it, but you may want to check it out.

    http://www.aletiainfo.com/index.php/...eview/11/1/13/
    Julian D. Muņoz - LANeros.com

  3. #3
    Jag Veteran dkadave's Avatar
    Join Date
    Sep 2001
    Location
    California, from Hawaii! Gotta love the ocean...
    Posts
    558
    Hmmm. that won't work! I'm currently looking for the code for you.
    ------------------------------------------------------------------------------------------------
    http://www.dkanet.com - http://www.vi01.com
    http://www.dkahost.com
    ------------------------------------------------------------------------------------------------
    AIM: dkadave - YIM: dkadave
    E-mail: dkanet@dkanet.com
    ------------------------------------------------------------------------------------------------

  4. #4
    Jag Veteran dkadave's Avatar
    Join Date
    Sep 2001
    Location
    California, from Hawaii! Gotta love the ocean...
    Posts
    558
    Here is a code I've found. Never tested it or anything. But try this.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} sub.domain.com$
    RewriteRule ^(.*)$ http://www.domain.com$1[L,R]
    ------------------------------------------------------------------------------------------------
    http://www.dkanet.com - http://www.vi01.com
    http://www.dkahost.com
    ------------------------------------------------------------------------------------------------
    AIM: dkadave - YIM: dkadave
    E-mail: dkanet@dkanet.com
    ------------------------------------------------------------------------------------------------

  5. #5
    Jag Veteran
    Join Date
    Sep 2002
    Posts
    650
    This is what I use. It's not perfect as it conflicts with the missing '/' rewrite (for directory indexing), but it's good enough for us.
    Put the following .htaccess file in the directory with your multihosted site, replace the domain name with your own and you are all set. No matter how you get to that directory, your URL will be 'canonised'.

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST}                !^www\.greeninferno\.com(:80)?$
    RewriteCond %{HTTP_HOST}                !^greeninferno\.com(:80)?$
    RewriteRule ^(.*)                      http://www.greeninferno.com/$1 [L,R]

  6. #6
    Jag Veteran dkadave's Avatar
    Join Date
    Sep 2001
    Location
    California, from Hawaii! Gotta love the ocean...
    Posts
    558
    Sorry, Here's the fix!

    RewriteEngine on
    RewriteCond %{HTTP_HOST} sub.domain.com$
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R]
    ------------------------------------------------------------------------------------------------
    http://www.dkanet.com - http://www.vi01.com
    http://www.dkahost.com
    ------------------------------------------------------------------------------------------------
    AIM: dkadave - YIM: dkadave
    E-mail: dkanet@dkanet.com
    ------------------------------------------------------------------------------------------------

  7. #7
    Loyal Client
    Join Date
    May 2002
    Location
    Wisconsin, USA
    Posts
    568
    Thanks for the help guys.

    Dave, when I put your fix into the .htaccess file, the url redirects, but it adds the directory of the subdomain at the end and I get a 404.

    In the address bar you see this:

    www.newdomain.com/subdomain/ (and you get a 404 message)

    instead of just www.newdomain.com


    Gerilya, how do I put an .htaccess file just into the directory of my multihosted site? With what Dave suggested, I was just editing the .htaccess file through the control panel.
    Last edited by JonathanB; 04-05-2003 at 09:40 AM.

  8. #8
    Aletia Customer
    Join Date
    Oct 2001
    Posts
    631
    What you want to do, is delete the subdomain. Not the folder, just the subdomain. You'll have to open a ticket and ask Jag to do this. Then ask them to add your new domain name to the domain registry, and go to your registrar, and change the DNS server for your domain to JagPC's DNS servers. Then you'll be hosting your domain like a real domain.

  9. #9
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003

    Gerilya, how do I put an .htaccess file just into the directory of my multihosted site? With what Dave suggested, I was just editing the .htaccess file through the control panel.
    I'm not Gerilya, but I can answer the question.

    You can put an htaccess file in any directory within your public_html. If will then have an effect on requests made to files in that directory or in any subdirectory within that directory. I create mine with a text editor and upload them by ftp. Windows sometimes doesn't like saving files with dots as the first character, so I usually call them htaccess.txt and rename them with ftp or ssh once I get them uploaded.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  10. #10
    Jag Veteran
    Join Date
    Sep 2002
    Posts
    650
    Jason:
    Thanks for taking care on this one

    JonathanB:
    You can also edit .htaccess file via control panel, it doesn't matter how you edit the file actually. I never use control panel for things I can do in command line (via SSH), so I guess my choice of words was confusing - sorry.

  11. #11
    Loyal Client
    Join Date
    May 2002
    Location
    Wisconsin, USA
    Posts
    568
    Thanks Jason and Gerilya. I had no idea you could have more than one .htaccess file for a site.

    That's also a good tip about editing it locally or through the command line. I've poked around a little on my site using the command line (with an SSH program) but I should probably work on learning more of that.

    Thanks again.

  12. #12
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    If you want to use multiple .htaccess files and edit them through CP, you'll have to do it from the file manager, not the .htaccess tool on the main menu. You probably guessed this already, but I thought I'd mention it anyway.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  13. #13
    Jag Veteran dkadave's Avatar
    Join Date
    Sep 2001
    Location
    California, from Hawaii! Gotta love the ocean...
    Posts
    558
    hmmm... I thought your wanted to include the sub-folders!

    if you don't just put

    RewriteEngine on
    RewriteCond %{HTTP_HOST} sub.domain.com$
    RewriteRule ^(.*)$ http://www.domain.com[L,R]

    And that would kill all sub-folders!
    ------------------------------------------------------------------------------------------------
    http://www.dkanet.com - http://www.vi01.com
    http://www.dkahost.com
    ------------------------------------------------------------------------------------------------
    AIM: dkadave - YIM: dkadave
    E-mail: dkanet@dkanet.com
    ------------------------------------------------------------------------------------------------

  14. #14
    Jag Veteran
    Join Date
    Sep 2002
    Posts
    650
    Also please note that rules in .htaccess file apply not only to the directory where the file is located, but also to all subdirectories.

  15. #15
    Loyal Client
    Join Date
    May 2002
    Location
    Wisconsin, USA
    Posts
    568
    Okay, now I'm even more confused.

    Dave, maybe I wasn't being clear. I still want to use my main domain (and all of its subfolders) but I also want the multihosted domain (which is set up in a subdomain) to resolve to the new domain name when someone enters by typing in the subdomain.

    If I understand you correctly Gerilya, it sounds like I need to try your solution in the folder that matches up with the subdomain. Then it will only apply to that folder. Right?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •