301重写域名.co.uk至网址:www.domain.co.uk就像搜索引擎友好的开发人员你!

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了301重写域名.co.uk至网址:www.domain.co.uk就像搜索引擎友好的开发人员你!相关的知识,希望对你有一定的参考价值。

Rewrite your urls for domain.co.uk to www.domain.co.uk including full url
  1. In your Virtual Host declaration add a ServerAlias under your ServerName declaration for example you would have
  2.  
  3. ServerName www.domain.co.uk
  4. ServerAlias domain.co.uk
  5.  
  6. This on it's own would mean that visitors will be sent to your site with or without the www. prefix.
  7.  
  8. What we can do is take the url they entered for example domain.co.uk/news/wow-look-at-this
  9. and rewrite it to
  10. www.domain.co.uk/news/wow-look-at-this
  11.  
  12. All you need to do is; within your .htaccess file for the site add the following at the top
  13.  
  14. RewriteCond %{HTTP_HOST} ^domain.co.uk
  15. RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [R=301,L]

以上是关于301重写域名.co.uk至网址:www.domain.co.uk就像搜索引擎友好的开发人员你!的主要内容,如果未能解决你的问题,请参考以下文章

Woocommerce重写单个产品页面URL

伪静态网址301重定向到静态网址怎么实现

301 重定向 - 替换 URL 的一部分

htaccess 重定向没有路径

htaccess 301 重定向新基础域名的通配符

如何使用动态 URL 进行 301 重定向并为新 URL 保留一些价值