![](/img/trans.png)
[英]how to redirect old url with parameters to new seo url using htaccess
[英]Cannot redirect to new url using .htaccess
我有一個html網頁,並且在網站徽標上,我將徽標URL寫為
example.com
,我現在想將所有對example.com
請求重定向到http://www.example.com
到目前為止,這是我的.htaccess
:
ErrorDocument 404 http://www.example.com/404.html
Redirect /index.html http://www.example.com
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]
example.com
未重定向到http://www.example.com
。
您需要在.htaccess
使用以下內容:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
在測試之前,請確保清除緩存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.