Hiện nay site e bị dính dupplicate trong GWT vì lý do google index 2 link, e VD thế này nhé: Link e muốn là nó như thế này: domain.com/id/ten-bai-viet-tacgia.html Nhưng gg index thêm: domain.com/id/ten-bai-viet_tacgia.html Nó khác nhau chỗ dấu "-" và dấu "_" trong URL, lỗi này là do lúc trc chưa tối ưu lại e để là dấu "_" nhưng sau này e sửa lại thành dấu "-" Giờ e muốn sử dụng 301 để chuyển sang hết "-" đc ko các bác? Và làm như thế nào? Mong các bác tư vấn giúp. Thanks
chưa hiểu ý bạn lắm, nếu bạn sửa link rồi thì xóa bài viết kia đi. Còn trong trường hợp bài viết trước đã được index lên top rồi thì cứ để nguyên. Trong trường hợp nó chưa lên top bạn xóa hẳn bài viết đó đi và thêm bài viết với link khác, sau khi xóa đi thì google sẽ thông báo lỗi thu thập dữ liệu và bạn vào xóa link đó đi là ok.
Mình nghĩ cách này tốt ưu hơn nè. Trong file .htaccess bạn ghi thế nào? Nếu ghi thế nàyPHP: RewriteRule ^san-pham-([a-zA-Z0-9\-_]+).html$ ?src=san-pham&name=$1 thì bác để ý ở phần này ([a-zA-Z0-9\-_]). Bác bỏ ký tự '_' thì tự động url có ký tự đó sẻ bị lổi 400. từ đó bác redirect về index hoặc gì đó thì tùy. -Còn nếu muốn dùng php thi bác kiểm tra url address coi nếu có tồn tại ký tự '_' thi chuyển sang trang bác muốn.
Cấu trúc của bạn như thế rồi thi bạn không chuyển sang được, nếu chuyển nó sẽ không nhận được biến sau "-",
bạn dùng 301 chuyển về thì quá tuyệt. Lam thế nào : bạn phải up code và file .htaccess lên mới biết dc, hỏi vậy potay
nếu bạn dùng wordpress thì nó sẽ có phần tối ưu hóa đường link rất tốt, ko bao giờ bị dính trường hợp như bạn đâu, hoặc joomla cũng có
Thanks các bác, đây là file .htaccess của e, các bác xem giúp e với Mã:ErrorDocument 400 /index.php ErrorDocument 401 /index.php ErrorDocument 403 /index.php ErrorDocument 404 /index.php ErrorDocument 500 /index.php RewriteEngine On RewriteCond %{HTTP_HOST} www.9nhac.com RewriteRule (.*) http://9nhac.com/$1 [R=301,L] RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^(http://|https://)(www.)?(9nhac.com).*$ [NC] RewriteRule \.(mp3)$ http://9nhac.com/info.jpg [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ song.php?act=listen&id=$1 [L] RewriteRule ^nghe/([0-9]*)/([^/]+).html index.php?v=nghe&id=$1 RewriteRule ^the-loai/([0-9]*)/([^/]+).html index.php?v=view&cat=$1 RewriteRule ^album/([0-9]*)/([^/]+).html index.php?v=albumdetail&id=$1 RewriteRule ^ca-sy/([0-9]*)/([^/]+).html index.php?v=singer&id=$1 RewriteRule ^nguoi-gui/([0-9]*)/([^/]+).html index.php?v=profile&id=$1 RewriteRule ^langnghe_dm_chom_link/([0-9]*).([^/]+) song2.php?act=listen&id=$1 RewriteRule ^list/([0-9]*).xml playalbum.php?act=listen&id=$1 RewriteRule ^nghesong/([0-9]*).xml getsong.php?sID=$1 RewriteRule ^download/([0-9]*).html song.php?act=download&id=$1 RewriteRule ^flash/([0-9]*).swf flash.php?id=$1 RewriteRule ^40/40.xml 40.php?id=1$ RewriteRule ^listcasi/([0-9]*).xml playcasi.php?singerID=$1 RewriteRule ^playlist/([0-9]*).xml playlist.php?mID=$1 RewriteRule ^ca-sy-dj/([0-9]*)/([^/]+).html index.php?v=viewsinger&id=$1 RewriteRule ^thong-tin-member/([0-9]*)/([^/]+).html index.php?v=profile&id=$1 RewriteRule ^nghe-playlist/([0-9]*)/([^/]+).html index.php?v=ngheplaylist&mID=$1 RewriteRule ^sua-playlist/([0-9]*).html index.php/?v=suaplaylist&mID=$1 RewriteRule ^sitemap.xml sitemap.php RewriteRule ^site-map-casi.xml site-map-casi.php RewriteRule ^sitemap-tl.xml sitemap-tl.php RewriteRule ^sitemapalb.xml sitemapalb.php RewriteRule !\.(html|php)$ - [S=4] RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=uscor:Yes] RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=uscor:Yes] RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=uscor:Yes] RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=uscor:Yes]