Apache Rewrite fails to find index.*

This is a discussion on Apache Rewrite fails to find index.* within the Apache Web Server forums, part of the Web Server and Related Forums category; This is my first time around the block with Apache (1.3.29 Linux) RewriteRule and I'm running into ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-10-2004
cg
 
Posts: n/a
Default Apache Rewrite fails to find index.*

This is my first time around the block with Apache (1.3.29 Linux)
RewriteRule and I'm running into a situation I don't understand.
Unfortunately, I'm on a commercial account that has only .htaccess control
so am unable to turn on rewrite logging for more info. While I can talk to
my hosting service about that, I keep thinking that there's something very
fundamental I'm not understanding so thought I'd try this forum first to see
if someone could explain where I'm going wrong.

The problem stems from the fact that my hosting service allows me to map a
number of add-on domains, each of which has its own content. As new add-on
domains are configured, the directory space on the server is divided up as
follows:

www // registered domain dir
index.html // registered domain index page
addon1 // addon1 subdir
index.html // addon1 index page
addon2 // addon2 subdir
index.html // addon2 index page

I tend to be organized so decided that a simple reconfiguration was in order
to insure that all my addon subdirectories don't get mixed in with my
registered domain content. It seemed simple enough to configure the
directory as follows:

www // top level now contains only subdirs
regdomain // registered domain dir
index.html // registered domain index page
addon1 // addon1 subdir
index.html // addon1 index page
addon2 // addon2 subdir
index.html // addon2 index page

and use RewriteRule point requests for the registered domain into the
regdomain folder:

## Rewrite Rule for www.regdomain.net
RewriteCond %{HTTP_HOST} ^www.regdomain.net$
RewriteCond %{REQUEST_URI} !regdomain/
RewriteRule ^(.*)$ regdomain/$1 [L]
RewriteRule ^/$ regdomain [L]
RewriteRule ^$ regdomain [L]
## Rewrite Rule for regdomain.net
RewriteCond %{HTTP_HOST} ^regdomain.net$
RewriteCond %{REQUEST_URI} !regdomain/
RewriteRule ^(.*)$ regdomain/$1 [L]
RewriteRule ^/$ regdomain [L]
RewriteRule ^$ regdomain [L]

When I use a url like www.regdomain.net/somefile.html, this works fine and
the rewrite displays somefile.html from the regdomain folder. What I don't
understand is that when I use a url like www.regdomain.net, the rewrite
fails. Using a bit of php, I can see that the url www.regdomain.net produces
the following:

HTTP_HOST = string(1) "/"
REQUEST_URI = string(17) "www.regdomain.net"

It seems to me that my RewriteRule must be wrong but I'm not seeing my
error. I'm hoping this will be obvious to someone who's familiar with
Rewrites.

Thanks!




  #2 (permalink)  
Old 01-10-2004
cg
 
Posts: n/a
Default Re: Apache Rewrite fails to find index.*

I'm not sure how I managed to miss this previously, but all's well with:

## Rewrite Rule for www.regdomain.net
RewriteCond %{HTTP_HOST} ^www.regdomain.net$
RewriteCond %{REQUEST_URI} !regdomain/
RewriteRule ^(.*)$ regdomain/$1
## Rewrite Rule for regdomain.net
RewriteCond %{HTTP_HOST} ^regdomain.net$
RewriteCond %{REQUEST_URI} !regdomain/
RewriteRule ^(.*)$ regdomain/$1

Sorry for the false alarm.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:59 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0