參數,以新的SEO URL要重定向PARAM網址,以搜索引擎友好的URL如何的舊網址重定向使用htaccess的
https://example.com/a.php?slug=vr-promised-us-the-future-too-bad-we-re-stuck-in-the-present
到
https://example.com/vr-promised-us-the-future-too-bad-we-re-stuck-in-the-present
和
https://example.com/tag.php?id=Virtual-reality
到
https://example.com/tag/Virtual-reality
我當前的.htaccess代碼
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)/?$ a.php?slug=$1 [L]
RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule^https://%1%{REQUEST_URI} [NE,L,R]
這htaccess的仍然是動態的(多域)和無域寫在所以不要更改它,並使用託管管理中的CNAME添加站點域,並添加虛擬主機以指向新的本地文件夾。 – 2017-10-12 16:43:59
@headmax感謝回覆,其實我的問題是如何阻止重複的網址(重定向舊=> /a.php?slug=vr-promised-us-the-future-too-bad-we-re-stuck-in-現在到/ vr-promised-us-the-future-too-bad-we-re-stuck-in-the-present) – pra021