10/10/2018, 11:19
giúp vể rewrite url
mình đã là theo hướng dẫn code ở file .htaccess trong thư mục gốc
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^test.html$ test.php [L]
</IfModule>
trên url mình chạy link http://localhost/test.html, file test.html là có thật nhưng nó không tự động chuyển thành http://localhost/test.php
M cũng đã bỏ # ở dòng rewrite_module trong file httpd.conf
Mong mọi người giúp
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^test.html$ test.php [L]
</IfModule>
trên url mình chạy link http://localhost/test.html, file test.html là có thật nhưng nó không tự động chuyển thành http://localhost/test.php
M cũng đã bỏ # ở dòng rewrite_module trong file httpd.conf
Mong mọi người giúp
Bài liên quan
Bạn sửa lại như sau nha
Bạn nào có thể giúp mình dc không?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
2 dòng này kiểm tra sự tồn tại của file và thư mục trước khi thực hiện luật
RewriteRule ^test.html$ test.php [L]
Rõ rằng nếu test.html tồn tại trên hồ sơ chỉ định bởi
RewriteBase /
thì luật RewriteRule ^test.html$ test.php [L] không được áp dụng.
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Google nó làm mọi người khổ nhỉ