Created
June 27, 2016 10:09
-
-
Save pcdinh/fc75ede83dbe07a0cdbb87a81a759796 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mở engine sửa đổi URL gốc | |
RewriteEngine on | |
# Tác động lên phần URL phía sau domain (REQUEST_URI) | |
RewriteBase / | |
# So sánh phần URL sau domain để xem có chứa ".css", ".gif" ... không. Nếu kết thúc bằng mấy cái đó thì bỏ qua | |
# Gửi URL như vậy thẳng vào engine của web server để xử lý và ngừng việc sửa ở đây. | |
RewriteCond %{REQUEST_URI} !.(css|gif|ico|jpg|js|png|swf|txt|pdf|docx|mp3|mp4|doc|zip|rar)$ | |
# Kiểm tra xem URL gửi đến có trực tiếp yêu cầu 1 file đã tồn tại hay không? Nếu file thực sự tồn tại thì gửi nguyên URL đó | |
# đến web server và ngừng việc sửa ở đây. | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# Kiểm tra xem URL gửi đến có trực tiếp yêu cầu 1 thư mục đã tồn tại hay không? Nếu file thực sự tồn tại thì gửi nguyên URL đó | |
# đến web server và ngừng việc sửa ở đây. | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# Tất cả các dạng URL còn lại gửi được xem như là URL /index.php?<uri-cũ> | |
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] | |
Sửa lại | |
RewriteEngine on | |
RewriteBase / | |
RewriteCond %{REQUEST_URI} !.(css|gif|ico|jpg|js|png|swf|txt|pdf|docx|mp3|mp4|doc|zip|rar)$ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !^crm/ | |
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment