本文介绍了我如何使用mod_rewrite 301重定向example到www.example?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要重定向的任何URL没有WWW。与URL的WWW。为更好的搜索引擎优化。我看,这是有可能的mod_rewrite及.htaccess文件,但我不知道正确的code使用。任何人都可以帮忙吗?
I need to redirect any URLs without "www." to URLs with "www." for better search engine optimization. I read that this is possible with mod_rewrite and .htaccess files, but I do not know the right code to use. Can anyone help?
推荐答案在你的根文件夹中创建一个名为.htaccess文件(一个在那里,说,的index.html或index.php文件所在)。把下面进去:
Create a file called .htaccess in your root folder (the one where, say, index.html or index.php resides). Put the following into it:
RewriteEngine on RewriteCond %{HTTP_HOST} ^yourdomain\ [NC] RewriteRule ^(.*)$ www.yourdomain/$1 [L,R=301]更多推荐
我如何使用mod
发布评论