| Author |
Message |
dieselmachine
Joined: 06 Feb 2008
Posts: 8
Location: Seattle, WA
|
| Posted: Thu Feb 07, 2008 11:05 pm Post subject: rewrite is directing people to the wrong index page? |
|
|
Hello! I have recently installed the mod_rewrite module, and configured it so when someone enters a subdomain (test.domain.com) they are transparently directed to domain.com/test/. It works okay, but when arriving at the destination, it claims it cannot find index.html there.
There is an index.php in there, shouldn't that be picked up too? I even went into /test/ and made an .htaccess file that says DirectoryIndex index.php. When i access the page via domain.com/test/, the index loads fine. When I go through test.domain.com, it says 'index.html is not found, bleh bleh'.
I need to know where the discrepancy here is being introduced, so I can fix it! Thanks! |
|
| Back to top |
|
nabber00
Joined: 02 Dec 2007
Posts: 24
|
| Posted: Fri Feb 08, 2008 1:16 pm Post subject: |
|
|
| Can you post the actual rewrite rules you are using? |
|
| Back to top |
|
dieselmachine
Joined: 06 Feb 2008
Posts: 8
Location: Seattle, WA
|
| Posted: Fri Feb 08, 2008 5:14 pm Post subject: |
|
|
Here is the full text of my main .htaccess file
DirectoryIndex index.html index.php index.htm
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^(www\.)?callsteward\.com$ [NC]
RewriteCond %{HTTP_HOST}<->%{REQUEST_URI} ^(www\.)?([^.]+).*<->/([^/]+) [NC]
RewriteCond %2<->%3 !^(.*)<->\1$ [NC]
RewriteRule ^(.+) /%2/$1 [PT,L] |
|
| Back to top |
|
nabber00
Joined: 02 Dec 2007
Posts: 24
|
| Posted: Fri Feb 08, 2008 9:29 pm Post subject: |
|
|
what happens if you change it to?
DirectoryIndex index.php index.html index.htm |
|
| Back to top |
|
dieselmachine
Joined: 06 Feb 2008
Posts: 8
Location: Seattle, WA
|
| Posted: Fri Feb 08, 2008 9:39 pm Post subject: |
|
|
The same exact thing happens.
Really, I did think of that, and had already tried it. The fact that I can navigate to the directory and have the .htaccess direct me to the .php page is proof that the DirectoryIndex line is not malconstructed.
It is something that is introduced when the subdomain is used. |
|
| Back to top |
|
dieselmachine
Joined: 06 Feb 2008
Posts: 8
Location: Seattle, WA
|
| Posted: Fri Feb 08, 2008 9:42 pm Post subject: |
|
|
Well, it seems that the index being searched for is the original index that would have matched had the main server been hit. Right now, the www subdomain has as its index a file called index.html, so i guess when any subdomain is reached, it looks for that for some reason.
Changing that to index.php means that every subdomain is now looking for that filename as the default. So it works.
Can anyone tell me where this behavior is controlled? Is this an effect of the rewrite file i'm using? |
|
| Back to top |
|
kernelkrash
Joined: 30 Dec 2007
Posts: 3
|
| Posted: Sat Feb 09, 2008 12:23 pm Post subject: |
|
|
Running a google search for what you appear to be wanting to do
( mod-rewrite + subdomain to dir )
Yielded:
http://www.webmasterworld.com/apache/3448467.htm
where they talked about using mod_alias and talk about
Quote: and the original address of
http://wiki.example.com/
would permanently redirect to
http://www.example.com/wiki/
It's worth a look anyway :>
All the best... |
|
| Back to top |
|
| |