Chào mọi người, cái web của em nó bình thường thì mặc định lúc nào trên web cũng có tenweb.dot/san-pham/ nghĩa là có dấu gạch chéo xẹc "/" ngang ở cuối, nhưng khi xóa nó đi thì nó không tự 301 sang url có dấu / cuối. Em muốn mỗi khi người dùng gõ: wenweb.dot/san-pham thì nó tự 301 url sang là: wenweb.dot/san-pham/ để mặc định web lúc nào cũng có dấu gạch chéo ở cuối web. Cảm ơn
Cái này chỉ cần vào tập tin .htaccess của web và chèn code sau vào là được: Cái đầu này xài ok nhất: đổi cái url: itseovn.com thành tên url của bạn nhé. Mã: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\..+$ RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) http://itseovn.com/$1/ [R=301,L] Hoặc Mã: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !index.php RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://itseovn.com/$1/ [L,R=301] Hoặc Mã: RewriteCond %{REQUEST_URI} !\.[^./]+$ RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://itseovn.com/$1/ [R=301,L] Hoặc Mã: RewriteEngine On RewriteBase / RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([a-zA-Z0-9]+) RewriteRule ^([a-zA-Z0-9]+)$ /%1/? [R=301,L] VD: khi gõ https://itseovn.com/threads/tu-dong-301-them-dau-gach-cheo-xec-cuoi-url-bi-thieu-wordpress.325789 web se tự động 301 sang: https://itseovn.com/threads/tu-dong-301-them-dau-gach-cheo-xec-cuoi-url-bi-thieu-wordpress.325789/