|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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! |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Mapping |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|