[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 11-22-2007, 10:24 AM   #1 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


How to do what del.icio.us does?

Hello,

I'm assuming this is all done in the .htaccess file(s), but I could be wrong. Hopefully someone can help.

For example, let's say I own 123.com and want my subdomain to be abc. So, I go into cPanel and create my subdomain. In my FTP, I now have two folders: one for 123.com, and one for abc.123.com
What I want is for abc.123.com to essentially become the main site--not 123.com
If you need clarification of what I'm asking, notice that when you type http://www.icio.us, no site exists; however, when you type http://del.icio.us, well...

How do I go about doing the same thing? I'm sure it's simple and I apologize for my ignorance in the matter, but I've never really dealt with subdomains before.

Thanks.
Jed K is offline  
Old 11-22-2007, 10:28 AM   #2 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
No need for any htaccess you just simply promote that sub domain rather than the main domain. If you really wanted too you could do a rewrite rule to forward the normal domain to the sub domain.

In the case of icio.us they have DNS set up but the connection does not get accepted. Personally I think this is a waste of traffic why don't they just forward to the sub domain.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft

Last edited by peter@flexiwebhost; 11-22-2007 at 10:37 AM.
Peter is offline  
Old 11-22-2007, 10:31 AM   #3 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Notice my example, though. http://www.icio.us does not exist and does not forward to http://del.icio.us. I want to do the same thing. I don't want http://www.123.com forwarding anywhere; I want http://abc.123.com to be the only option.
Jed K is offline  
Old 11-22-2007, 10:38 AM   #4 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
why that is a waste of traffic. Anyone coming to the domain name would be lost. Why not forward them to the sub domain?
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 11-22-2007, 11:26 AM   #5 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Suppose so. Was just interested in knowing how to do it. However, I guess I'll go your route. But...

I use add-on domains with cPanel, so for those of you familiar with how that works, let's say the domain name I receive hosting with is nemesisxg.com, and the add-on domain is 123.com
What I now need is for my .htaccess file to redirect to abc.123.com whenever any of the following URLs are entered:
www.123.nemesisxg.com
123.nemesisxg.com
www.123.com
123.com

What should my .htaccess file look like? Something like the following I suppose, but I don't know the minor details to make it work correctly. For example, I think I need some [OR]'s in there/etc:

Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^123.nemesisxg.com$
RewriteCond %{HTTP_HOST} ^www.123.nemesisxg.com$
RewriteCond %{HTTP_HOST} ^www.123.com$
RewriteCond %{HTTP_HOST} ^123.com$
RewriteRule ^(.*)$ http://abc.123.com [R=301,L]
I also want to include the following bit of code (or something similar) in there so that the www never shows up in the url (I want abc.123.com, not www.abc.123.com):

Code:
RewriteCond %{HTTP_HOST} ^www\.(.*) [nc]
RewriteRule ^(.*)$ http://%1/$1 [r=301,nc,l]
How should I put it all together most effectively? Any help will be much appreciated and a rep sure to follow.

Thanks.
Jed K is offline  
Old 11-23-2007, 04:15 AM   #6 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


50 NP$ and a positive rep to the first person who helps me get this right.
Jed K is offline  
Old 11-23-2007, 04:22 AM   #7 (permalink)
Danltn.com
 
Daniel's Avatar
 
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
13.51 NP$ (Donate)

Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute

Ethan Allen Fund Ethan Allen Fund
Remove www:

Code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.your\.site\.us$ [NC]
RewriteRule ^(.*)$ http://your.site.us/$1 [R=301,L]
Simply use a redirect header for the different pages. Typically

PHP Code:
header("Location: http://your.site.us",TRUE,301);
To make all pages under / go to index.php try

Code:
RewriteRule .* /index.php [R=301,L]
Not tested. Small adjustments may be needed.
Daniel is offline  
Old 11-23-2007, 05:28 AM   #8 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


So how exactly do the header redirects work? I'm looking to accomplish the redirects through the same (or at least similar) method as I've posted above (unless it's going about things the completely wrong way).

Due to my complete lack of knowledge regarding .htaccess files, ideally I'd like to have the full code posted for what needs to be in my .htaccess file. If this isn't possible, I guess I'll continue to fiddle around with things on my own later on.

Appreciate your response. Thanks.
Jed K is offline  
Old 11-23-2007, 06:47 AM   #9 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
you could simply have the following in your htaccess to direct to the correct subdomain:-

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^sub.domain.com]$
RewriteRule ^(.*)$ http://sub.domain.com [R=301,L]
This forwards anything that is not sub.domain.com to http://sub.domain.com and uses a 301 redirect so that search engines etc know there is no content on the particular URL they were trying.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 11-23-2007, 08:48 AM   #10 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Thanks, Peter.

Almost works except for that it still forwards to http://www.sub.domain.com as opposed to http://sub.domain.com
...but it's a start. Just about there I think.

Jed K is offline  
Old 11-23-2007, 08:56 AM   #11 (permalink)
Danltn.com
 
Daniel's Avatar
 
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
13.51 NP$ (Donate)

Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute

Ethan Allen Fund Ethan Allen Fund
This code should remove www.

Code:
RewriteCond %{HTTP_HOST} ^www\.your\.site\.us$ [NC]
RewriteRule ^(.*)$ http://your.site.us/$1 [R=301,L]
Daniel is offline  
Old 11-23-2007, 09:32 AM   #12 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Do I add it below the code Peter already provided? Do I use it instead? Either way, not working as of yet. Still showing the www

Also, should the the .htaccess be in my main site folder, or in the subdomain folder? Again, I've tried both and it's still not working.

Bit of a pain, yeah?
Thanks.
Jed K is offline  
Old 11-23-2007, 09:58 AM   #13 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
the htaccess should be in the folder for your main domain not the subdomain.

Is the code I provided the only content of your .htaccess file? I can't see any reason why it should forward too http://www.sub.domain.com
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 11-23-2007, 10:19 AM   #14 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Perhaps has something to do with the fact it's an add-on domain in cPanel? I don't know. Awful frustrating, yeah?

Edit:
Will get in touch with host tomorrow and see if I/we can figure this out. I'll keep you posted.

Last edited by NemesisXG; 11-23-2007 at 10:48 AM.
Jed K is offline  
Old 11-23-2007, 11:48 AM   #15 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute

Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
ahh I think I have realized the problem. It is not that it is forwarding to http://www.sub.domain.com but http://www.domain.com is not forwarding.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 11-23-2007, 09:25 PM   #16 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Host not going to help with this. They don't bother with coding issues I guess.

Anyway, I think I may have an idea as to what the problem is:
In my main site's .htaccess, I tell it to always use the www version with the following code:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
...so perhaps it is forcing my add-on domain to always use the www version as well since this .htaccess file is global? I tried removing it to check, but unfortunately, the www STILL showed up with my add-on domain... so perhaps this isn't the problem after all? Wish I knew what's wrong...

Increasing my offer to 100 NP$, possibly more, if someone is able to get things working.
Jed K is offline  
Old 11-23-2007, 10:14 PM   #17 (permalink)
NamePros Legend
 
weblord's Avatar
 
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,840
21,700.43 NP$ (Donate)

weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness

Autism Protect Our Planet
all i know it's doable via dns zone editing
http://network-tools.com/default.asp...st=del.icio.us

del.icio.us has A 69.147.76.140
www.icio.us has no A entry
icio.us no A entry
weblord is offline  
Old 11-24-2007, 12:39 AM   #18 (permalink)
Danltn.com
 
Daniel's Avatar
 
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
13.51 NP$ (Donate)

Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute

Ethan Allen Fund Ethan Allen Fund
PM me with details and a login, I'll attempt to do this for you later if you like.

Dan
Daniel is offline  
Old 11-24-2007, 03:14 AM   #19 (permalink)
o-re-sa-ma
 
Jed K's Avatar
 
Join Date: Jun 2003
Location: Japan
Posts: 1,508
626.00 NP$ (Donate)

Jed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to beholdJed K is a splendid one to behold


Host was able to fix it for me. They had no intention of doing so at first, but ended up looking into it after my reply. All is working now.

Not exactly sure how they fixed it, but I'll post the code so that perhaps someone else in the same situation can find help in the future.


This .htaccess file goes in your addon domain folder:
Code:
Options +FollowSymlinks
RewriteEngine on
#RewriteCond ^$ [NC]
#RewriteRule ^(.*)$ http://subdomain.addondomain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www.addondomain.com [NC]
RewriteRule (.*) http://subdomain.addondomain.com/$1 [R=301,L]
This .htaccess file goes in your addon's subdomain folder:
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.subdomain.addondomain.com
RewriteRule ^(.*)$ http://subdomain.addondomain.com/$1 [R=permanent,L]
Make sure to replace subdomain and addondomain with your own details. Should work.

Thanks to all who took the time to try and help. Much appreciated.

Last edited by NemesisXG; 11-24-2007 at 03:22 AM.
Jed K is offline  
Old 11-24-2007, 07:51 AM   #20 (permalink)
NamePros Regular
 
Frikkle's Avatar
 
Join Date: Jun 2007
Location: Cambridge, MA
Posts: 751
11.15 NP$ (Donate)

Frikkle is a splendid one to beholdFrikkle is a splendid one to beholdFrikkle is a splendid one to beholdFrikkle is a splendid one to beholdFrikkle is a splendid one to beholdFrikkle is a splendid one to beholdFrikkle is a splendid one to beholdFrikkle is a splendid one to behold


Or, you could just tell your webhost to change your main domain to your subdomain, and you would forward the subdomain via A record at your registrar to the cPanel account.

-Frikkle
__________________
It is difficult to get a man to understand something when his salary depends upon his not understanding it.
Upton Sinclair
Frikkle is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 04:45 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85