| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| o-re-sa-ma | 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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #2 (permalink) |
| Senior Member | 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. |
| |
| | #3 (permalink) |
| o-re-sa-ma | 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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #4 (permalink) |
| Senior Member | 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 |
| |
| | #5 (permalink) |
| o-re-sa-ma | 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]
Thanks.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #6 (permalink) |
| o-re-sa-ma | 50 NP$ and a positive rep to the first person who helps me get this right.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #7 (permalink) |
| Danltn.com | Remove www: Code: Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.your\.site\.us$ [NC]
RewriteRule ^(.*)$ http://your.site.us/$1 [R=301,L]
PHP Code: Code: RewriteRule .* /index.php [R=301,L] |
| |
| | #8 (permalink) |
| o-re-sa-ma | 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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #9 (permalink) |
| Senior Member | 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 |
| |
| | #10 (permalink) |
| o-re-sa-ma | 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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #12 (permalink) |
| o-re-sa-ma | 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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #13 (permalink) |
| Senior Member | 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 |
| |
| | #14 (permalink) |
| o-re-sa-ma | 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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ Last edited by NemesisXG; 11-23-2007 at 10:48 AM. |
| |
| | #15 (permalink) |
| Senior Member | 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 |
| |
| | #16 (permalink) |
| o-re-sa-ma | 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]
Increasing my offer to 100 NP$, possibly more, if someone is able to get things working.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ |
| |
| | #17 (permalink) |
| NamePros Legend | 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 |
| |
| | #19 (permalink) |
| o-re-sa-ma | 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]
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.
__________________ VQTE - Community for political talk & debate / 2008 election @ http://www.vqte.com/ Final Fantasy XII US - Final Fantasy XII / Final Fantasy 12 / FFXII / FF12 @ http://www.ffxii.us/ Last edited by NemesisXG; 11-24-2007 at 03:22 AM. |
| |
| | #20 (permalink) |
| NamePros Regular | 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 |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |