![](/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.