httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Seaton <ch...@chrisseaton.com>
Subject Re: [users@httpd] mod_rewrite not applied to default files?
Date Sun, 26 Jun 2005 01:59:46 GMT
Aman Raheja wrote:
> I think you should to one more rewrite before the other rules and that is
> RewriteRule /$ /index\.html
> or
> RewriteRule ^/$ /index\.html
> as you need.
> HTH
> Aman Raheja
> http://www.techquotes.com

I see what this does - rewrite / to /index.html, but I'm already 
refering to %{REQUEST_FILENAME}, which is the resolved file name and so 
will already be /index.html for /, won't it?

I tried it out, and for my / page, nothing changed, however, for 
directories such as /foo/ and /foo/bar/ I'm now getting served the page 
for / - although it does get served with application/xhtml\+xml!

I really appreciate the help. Any other ideas? This has been driving me 
crazy for days.

Chris

> Chris Seaton wrote:
> 
>> Hi,
>>
>> I'm using mod_rewrite to send .html files as application/xhtml+xml for 
>> agents that say they accept it, and text/html for all others, using 
>> mod_rewrite.
>>
>> At the moment I simply have a .htaccess file with
>>
>> RewriteEngine on
>> RewriteCond %{REQUEST_FILENAME}     \.html$
>> RewriteCond %{HTTP_ACCEPT}          application/xhtml\+xml
>> RewriteRule .* - [T=application/xhtml+xml]
>>
>> This works fine on, for example, 
>> http://chrisseaton.skylis.net/index.html, but it does not work on, for 
>> example, http://chrisseaton.skylis.net/. mod_rewrite doesn't seem to 
>> be applied when serving a default file for a directory.
>>
>> I tested this by modifying my .htaccess to read
>>
>> RewriteEngine on
>> RewriteRule .* - [T=application/xhtml+xml]
>>
>> With this every file should be served as application/xhtml+xml, and 
>> they all were, apart from the default file for the directory - which 
>> still went out as the .html default of text/html.
>>
>> I'm using Mozilla HTTP live headers to check the MIME type returned by 
>> the server.
>>
>> Can anyone help? Thanks a lot.
>>
>> Chris Seaton
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server 
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message