Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 18th, 2002, 02:31 AM
usuallyconfused usuallyconfused is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Surrey
Posts: 23 usuallyconfused User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 52 sec
Reputation Power: 0
Mapping

I have checked previous posts and have the distinct impression that this has been answered many times, but I seem to be missing something.

I have more than 1 domain pointing at my server and have set up Virtual Hosts to handle them without problem:

<VirtualHost *>
ServerName www.domain.com
DocumentRoot "c:/Apache/adirectory"
</VirtualHost>

However, I would like people to type in "www.domain.com/something" and have that mapped to a directory, or "www.domain.com/somethingelse" and have that mapped to another directory. These mapped directories would have their own index.html pages.

Reply With Quote
  #2  
Old March 18th, 2002, 06:02 AM
pippo's Avatar
pippo pippo is offline
A PAtCHy sErver
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Italy
Posts: 410 pippo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Put within your VirtualHost block these rules:

RewriteEngine On
RewriteRule ^/something/(.*)$ /something2/$1 [L]
RewriteRule ^/somethingelse/(.*)$ /somethingelse2/$1 [L]

Replace
[L] with [R,L] for an external redirection
__________________
My article: mod_rewrite: No More Endless Loops!

Reply With Quote
  #3  
Old March 19th, 2002, 02:27 AM
usuallyconfused usuallyconfused is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Surrey
Posts: 23 usuallyconfused User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 52 sec
Reputation Power: 0
Hmm. Thanks for the reply, but it doesn't seem to work.

I assume that the first section ^/something bit refers to what is put after the ServerName specified in the VirtualHost block, as in www.domain.com/something.

I assume also that the second section /something2 refers to a directory off the DocumentRoot, also specified in the VirtualHost block.

So, if I create a directory called something2 off the DocumentRoot and put an index.html file in it, then entering www.domain/something into a browser will bring up the index.html file mentioned.

Am I missing it entirely?

Reply With Quote
  #4  
Old March 20th, 2002, 04:40 AM
usuallyconfused usuallyconfused is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Surrey
Posts: 23 usuallyconfused User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 52 sec
Reputation Power: 0
Ah, ha!

Got things working now. After considerable investigation (God bless the Internet) I am beginning to get my head round the mod_rewrite module. It's rather confusing at first and none of the literature is very good at explaining the use of symbols. Maybe everyone assumes that because you are playing around with a web server, you know more about it that you do.

And I think I might have mislead pippo on what I was trying do, but it is so powerful that I have changed my ideas anyway.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Mapping


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT