Skip to main content

DirectoryIndex vs RewriteEngine

Published 1 min readMarkdown

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

About the author

  • Khanh is a full stack web developer with over 15 years of experience developing for the web

No comments yet. Be the first to comment.

More from this blog