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
Old 03-02-2009, 05:57 PM   #1 (permalink)
Junior Member
 
desbest's Avatar
 
Join Date: 02-17-06
Posts: 21
iTrader: 0 / 0%
Latest Blog:
None

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]
desbest is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-03-2009, 09:56 AM   #2 (permalink)
Contributing Member
 
Join Date: 08-22-08
Posts: 58
iTrader: 0 / 0%
Latest Blog:
None

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]
cont911 is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-03-2009, 10:34 AM   #3 (permalink)
Junior Member
 
desbest's Avatar
 
Join Date: 02-17-06
Posts: 21
iTrader: 0 / 0%
Latest Blog:
None

desbest is liked by many
Doesn't work.
I found a solution here.
desbest is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-03-2009, 10:40 AM   #4 (permalink)
Moderator
 
alter-ego's Avatar
 
Join Date: 03-03-09
Location: Under your wife.
Posts: 535
iTrader: 0 / 0%
Latest Blog:
Homelessness

alter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to beholdalter-ego is a splendid one to behold
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.
alter-ego is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-03-2009, 11:17 AM   #5 (permalink)
Junior Member
 
desbest's Avatar
 
Join Date: 02-17-06
Posts: 21
iTrader: 0 / 0%
Latest Blog:
None

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.
desbest is offline  
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 On


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


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


All times are GMT -7. The time now is 01:40 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


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