Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-02-2009, 04:57 PM
desbest's Avatar
Member
Latest Blog:
None

 
Join Date: 02-17-06
Posts: 31
iTrader: 0 / 0%
desbest is liked by many
I can point subdomains to subfolders, but not sub-subfolders

I can point subdomains to subfolders, but not sub-subfolders. How can I?

Code:
RewriteEngine on # Rewrite <subdomain>.example.com/<path> to example.com/<subdomain>/<path> # # Skip rewrite if no hostname or if subdomain is www RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\. [NC] # Extract (required) subdomain (%1), and first path element (%3), discard port number if present (%2) RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.hostingz\.org(:80)?<>/([^/]*) [NC] # Rewrite only when subdomain not equal to first path element (prevents mod_rewrite recursion) RewriteCond %1<>%3 !^(.*)<>\1$ [NC] # Rewrite to /subdomain/path RewriteRule ^(.*) /%1/$1 [L]
What that code does is redirect http://subdomain.hostingz.org to http://hostingz.org/subdomain. And it works!

But how do I modify the last line, the RewriteRule so that it redirects to sites/(then the subdomain).

So http://subdomain.hostingz.org --> http://hostingz.org/sites/subdomain.

How can it be done? And test it out first as the examples below do not work.
Code:
RewriteRule sites/^(.*) /%1/$1 [L]
or
Code:
RewriteRule sites^(.*) /sites/%1/$1 [L]
Code:
RewriteRule ^(.*) /sites/%1/$1 [L]
__________________
I do as I say, and I say what I do, I say what is right, and I do what is true.
Life is good once you do as you know it should.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #2 (permalink)  
Old 03-03-2009, 08:56 AM
Contributing Member
Latest Blog:
None

 
Join Date: 08-22-08
Posts: 58
iTrader: 0 / 0%
cont911 is on the right pathcont911 is on the right path
try this:

RewriteEngine On
RewriteRule ^www\.hostingz\.org.*$ - [L]
RewriteRule ^(.*)\.hostingz.org(.*)$ http:\\hostingz.org\sites\$1$2 [L]
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #3 (permalink)  
Old 03-03-2009, 09:34 AM
desbest's Avatar
Member
Latest Blog:
None

 
Join Date: 02-17-06
Posts: 31
iTrader: 0 / 0%
desbest is liked by many
Doesn't work.
I found a solution here.
__________________
I do as I say, and I say what I do, I say what is right, and I do what is true.
Life is good once you do as you know it should.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #4 (permalink)  
Old 03-03-2009, 09:40 AM
alter-ego's Avatar
Moderator
Latest Blog:
None

 
Join Date: 03-03-09
Location: Lower Mainland B.C.
Posts: 885
iTrader: 0 / 0%
alter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web proalter-ego is a highly respected web pro
If you don't mind my asking, why would you want to have a sub-subdomain? I've never heard of this until now hence my query.

My apologies if I'm missing the point.
Digg this Post!Add Post to del.icio.us
Reply With Quote
  #5 (permalink)  
Old 03-03-2009, 10:17 AM
desbest's Avatar
Member
Latest Blog:
None

 
Join Date: 02-17-06
Posts: 31
iTrader: 0 / 0%
desbest is liked by many
I'm not on about sub-subdomains because that's silly. You're right.

I'm instead on about sub-sub folders. The htaccess code I originally had only worked with subfolders which resided in the root directory.
The solution hyperlink which I posted on my post above solves this problem.
__________________
I do as I say, and I say what I do, I say what is right, and I do what is true.
Life is good once you do as you know it should.
Digg this Post!Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


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

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
subdomains.... kingpinnz Domain Name Forum 2 07-03-2008 08:45 PM
Subdomains vs. Folders Hopeful Domain Name Forum 5 03-19-2007 12:16 PM
Subdomains scisoft SEO Forum 3 02-11-2004 11:57 PM
Subdomains? cltwebs Web Design Lobby 9 02-08-2004 02:01 PM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 07:23 AM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.