It's me ;-)

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:

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:

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!!!

2 thoughts on “DirectoryIndex vs RewriteEngine

  1. 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ẻ!

Leave a Reply to luubk Cancel reply

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