Re: [users@httpd] mod_rewrite not applied to default files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux