DirectoryIndex vs RewriteEngine

Tôi dùng modRewrite cho site hanhnguyenhotel.com. Mọi chuyện đều ổn nếu như thằng Kid không yêu cầu có cái trang intro (index.html). Mặc dù tôi đã để default file là index.html nhưng vẫn không ăn thua:

1
2
3
4
5
Options -Indexes
DirectoryIndex index.html index.php
RewriteEngine on
RewriteCond $1 !^(index\.html|modules|robots\.txt)
RewriteRule ^(.*)$ index.php?mod=$1 [L,QSA]

Chính xác thì phải thế này:

1
2
3
4
5
6
7
8
9
Options -Indexes
 
DirectoryIndex index.html index.php
 
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.html|modules|robots\.txt)
RewriteRule ^(.*)$ index.php?mod=$1 [L,QSA]

Okie, work fine!!!

[Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
This entry was posted in Apache. Bookmark the permalink.

2 Responses to DirectoryIndex vs RewriteEngine

  1. luubk says:

    Chào anh Khánh, em biết anh từ hồi dùng blog Opera, lâu rồi em cũng không dùng blog Opera nữa, giờ chuyển sang dùng blog WordPress địa chỉ http://luubk.com

    Tuy không dùng blog Opera nhưng em vẫn theo dõi tin tức từ Google Reader của anh. Hôm nay đọc tin từ blog của anh, biết được blog này. Em muốn trao đổi liên kết với blog của anh được không anh?

    Chúc anh vui vẻ!

  2. Rất vui được đặt link exchange với em ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

CAPTCHA image
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>