| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | #2 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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.
|
| |
| | THREAD STARTER #3 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | #4 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 |
| |
| | THREAD STARTER #5 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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] Code: RewriteCond %{HTTP_HOST} ^www\.(.*) [nc]
RewriteRule ^(.*)$ http://%1/$1 [r=301,nc,l] ????: NamePros.com http://www.namepros.com/showthread.php?t=398641 Thanks. |
| |
| | #7 (permalink) |
| Danltn.com Join Date: May 2007 Location: Danltn.com / Nottingham, UK
Posts: 1,201
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Remove www: Code: Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.your\.site\.us$ [NC]
RewriteRule ^(.*)$ http://your.site.us/$1 [R=301,L] ????: NamePros.com http://www.namepros.com/showthread.php?t=398641 PHP Code: Code: RewriteRule .* /index.php [R=301,L]
__________________ |
| |
| | THREAD STARTER #8 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | #9 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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]
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | THREAD STARTER #10 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | THREAD STARTER #12 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | #13 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 |
| |
| | THREAD STARTER #14 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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.
|
| |
| | #15 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 |
| |
| | THREAD STARTER #16 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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] ????: 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. |
| |
| | #17 (permalink) |
| NamePros Legend Join Date: Dec 2005 Location: Philippines - www.Nabaza.com
Posts: 19,785
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 |
| |
| | THREAD STARTER #19 (permalink) |
| o-re-sa-ma Join Date: Jun 2003
Posts: 1,599
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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] Code: RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.subdomain.addondomain.com
RewriteRule ^(.*)$ http://subdomain.addondomain.com/$1 [R=permanent,L] Thanks to all who took the time to try and help. Much appreciated.
Last edited by NemesisXG; 11-24-2007 at 04:22 AM.
|
| |
| | #20 (permalink) |
| NamePros Regular Join Date: Jun 2007 Location: Cambridge, MA
Posts: 754
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 |
| |