NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [resolved] How to do what del.icio.us does?

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-22-2007, 11:24 AM THREAD STARTER               #1 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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.
????: NamePros.com http://www.namepros.com/programming/398641-resolved-how-do-what-del-icio.html

Thanks.
Jed K is offline  
Old 11-22-2007, 11:28 AM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
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 11:37 AM.
Peter is offline  
Old 11-22-2007, 11:31 AM THREAD STARTER               #3 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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, 11:38 AM   #4 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
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, 12:26 PM THREAD STARTER               #5 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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.
????: NamePros.com http://www.namepros.com/showthread.php?t=398641

Thanks.
Jed K is offline  
Old 11-23-2007, 05:15 AM THREAD STARTER               #6 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



50 NP$ and a positive rep to the first person who helps me get this right.
Jed K is offline  
Old 11-23-2007, 05:22 AM   #7 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
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
????: NamePros.com http://www.namepros.com/showthread.php?t=398641

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, 06:28 AM THREAD STARTER               #8 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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, 07:47 AM   #9 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
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, 09:48 AM THREAD STARTER               #10 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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, 09:56 AM   #11 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
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, 10:32 AM THREAD STARTER               #12 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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, 10:58 AM   #13 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
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, 11:19 AM THREAD STARTER               #14 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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 11:48 AM.
Jed K is offline  
Old 11-23-2007, 12:48 PM   #15 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
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, 10:25 PM THREAD STARTER               #16 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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...
????: NamePros.com http://www.namepros.com/showthread.php?t=398641

Increasing my offer to 100 NP$, possibly more, if someone is able to get things working.
Jed K is offline  
Old 11-23-2007, 11:14 PM   #17 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
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
__________________
Nabaza.com - Amaia
weblord is offline  
Old 11-24-2007, 01:39 AM   #18 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
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, 04:14 AM THREAD STARTER               #19 (permalink)
o-re-sa-ma
 
Jed K's Avatar
Join Date: Jun 2003
Posts: 1,599
Jed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud ofJed K has much to be proud of
 



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.
????: NamePros.com http://www.namepros.com/showthread.php?t=398641


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 04:22 AM.
Jed K is offline  
Old 11-24-2007, 08:51 AM   #20 (permalink)
NamePros Regular
 
Frikkle's Avatar
Join Date: Jun 2007
Location: Cambridge, MA
Posts: 754
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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:21 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger