My URLs look like "/pages.php?page=pageName" because I am using a database to supply the page's content. Does rewriting URLs to something like "/pageName" help search engines find the pages? If so how do I rewrite them?
我的网址看起来像“/pages.php?page=pageName”,因为我使用的是数据库来提供网页的内容。重写URL到“/ pageName”之类的东西会帮助搜索引擎查找页面吗?如果是这样,我该如何重写它们?
10 个解决方案
#1
It probably doesn't help a crawler to find the pages, but it may have a positive impact in how it's going to rank them, as better URIs get usually better ranking (other things being equal, of course). It's also good to have them permanent.
它可能无法帮助爬虫找到页面,但它可能会对它们如何排名产生积极影响,因为更好的URI通常会获得更好的排名(当然,其他条件相同)。让它们永久化也很好。
请参阅Cool URI不要更改
About how you have mod_rewrite in Apache world and some other options in IIS world.
关于如何在Apache世界中使用mod_rewrite以及IIS世界中的其他一些选项。
Example (Apache's syntax):
示例(Apache的语法):
RewriteEngine On
RewriteRule ^(.*)$ pages.php?page=$1
That will pass everything in the URI after the domain name (there's a caveat regarding the trailing slash) to pages.php as a page parameter.
这会将域名后面的所有内容(关于斜杠的警告)传递给pages.php作为页面参数。
This is
http://yourdomain.com/bears
will return the content as served by
将返回由服务提供的内容
http://yourdomain.com/pages.php?page=bears
#2
Maybe a better question is "Does rewriting a URL help a user find the page in a search engine?". And the answer to this is "yes". For example, let's say that the content of your page discusses dolphins. Google puts more weight for the search term "Dolphins" into:
也许更好的问题是“重写URL是否有助于用户在搜索引擎中找到该页面?”。答案是肯定的。例如,假设您的网页内容讨论了海豚。谷歌将“海豚”这一搜索词更加重视:
/Dolphins.php
than
/pages.php?page=1323
You'll find this is what most modern websites are doing (including *).
您会发现这是大多数现代网站正在做的事情(包括*)。
#3
Google's SEO Guide mentions a few tips regarding URLs under the "Improve the structure of your URLs" section.
Google的SEO指南在“改善网址结构”部分中提到了一些有关网址的提示。
#4
You can create .htaccess file in root of site and add this into file:
您可以在站点的根目录中创建.htaccess文件并将其添加到文件中:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/pages/(.*) pages.php?page=$1
#5
Check out this blog entry from google.
从谷歌查看此博客条目。
Specially this quote.
特别是这句话。
One recommendation is to avoid reformatting a dynamic URL to make it look static
一个建议是避免重新格式化动态URL以使其看起来是静态的
#6
It doesn't help the search engines find the page easier (in fact if not implemented properly it can make it harder for the search engines to crawl your site) but if done properly it will make your pages rank better for their relevant keywords
它无助于搜索引擎更容易找到页面(事实上,如果没有正确实施,它可能会使搜索引擎难以抓取您的网站)但如果操作正确,它会使您的网页在相关关键字中排名更高
For PHP look at mod_rewrite for Apache
对于PHP,请查看Apache的mod_rewrite
I'm not a regex expert but it uses pattern matching rules to perform the rewrite, there will be lots of documentation and tutorials online for mod_rewrite
我不是正则表达式专家,但它使用模式匹配规则来执行重写,mod_rewrite将有大量的在线文档和教程
#7
It won't help the search engines to find them more easily. To make sure the search engines find your pages, the two most important things you can do are:
它不会帮助搜索引擎更容易找到它们。为了确保搜索引擎找到您的网页,您可以做的两件最重要的事情是:
-
Create a sitemap, reference it in your robots.txt, and register it with Google WebMaster tools
创建站点地图,在robots.txt中引用它,并使用Google WebMaster工具进行注册
-
Make sure you actually have spiderable, non-javascript links (preferably text links) to all the pages on your site.
确保您的网站上的所有网页实际上都有可播放的非JavaScript链接(最好是文字链接)。
#8
The search engines will like your pages a lot more. If there is a dynamic file ending and a querystring, most search engines thinks it's a dynamic page, which will change soon, and therefore won't rank it as high as static pages.
搜索引擎会更喜欢您的网页。如果有动态文件结束和查询字符串,大多数搜索引擎认为它是一个动态页面,它将很快改变,因此不会像静态页面那样高。
Then you've got the rewrite in place, you can easily parse it in your PHP and decide your url structure with php.
然后你已经完成了重写,你可以在PHP中轻松解析它并用php决定你的url结构。
#9
Would like to emphasis the need for an extension to the page, e.g. .html and the fact that slashes inside the url are interpreted as virtual directory paths inside the site's "tree map".
想要强调对页面的扩展的需要,例如.html以及url中的斜杠被解释为站点“树形图”内的虚拟目录路径这一事实。
There is more "weight" as Keltex said in paths like category.html than /category/subcategory.html
Keltex在类似于category.html的路径中比/category/subcategory.html更多的“重量”
Anyways it is mandatory to implement the friendly urls along with a sitemap. All that combined with basic SEO title,proper headings gives you a nice result.
无论如何,必须实现友好的URL和站点地图。所有这一切加上基本的SEO标题,正确的标题给你一个很好的结果。
#10
For SEO purposes, it is best to include your keyword in the URL. However, if it's already a published page, make sure that you set up a redirect from the existing URL to the new URL before making the change. Nobody likes a broken link.
出于搜索引擎优化的目的,最好在URL中包含您的关键字。但是,如果它已经是已发布的页面,请确保在进行更改之前设置从现有URL到新URL的重定向。没有人喜欢断链。
#1
It probably doesn't help a crawler to find the pages, but it may have a positive impact in how it's going to rank them, as better URIs get usually better ranking (other things being equal, of course). It's also good to have them permanent.
它可能无法帮助爬虫找到页面,但它可能会对它们如何排名产生积极影响,因为更好的URI通常会获得更好的排名(当然,其他条件相同)。让它们永久化也很好。
请参阅Cool URI不要更改
About how you have mod_rewrite in Apache world and some other options in IIS world.
关于如何在Apache世界中使用mod_rewrite以及IIS世界中的其他一些选项。
Example (Apache's syntax):
示例(Apache的语法):
RewriteEngine On
RewriteRule ^(.*)$ pages.php?page=$1
That will pass everything in the URI after the domain name (there's a caveat regarding the trailing slash) to pages.php as a page parameter.
这会将域名后面的所有内容(关于斜杠的警告)传递给pages.php作为页面参数。
This is
http://yourdomain.com/bears
will return the content as served by
将返回由服务提供的内容
http://yourdomain.com/pages.php?page=bears
#2
Maybe a better question is "Does rewriting a URL help a user find the page in a search engine?". And the answer to this is "yes". For example, let's say that the content of your page discusses dolphins. Google puts more weight for the search term "Dolphins" into:
也许更好的问题是“重写URL是否有助于用户在搜索引擎中找到该页面?”。答案是肯定的。例如,假设您的网页内容讨论了海豚。谷歌将“海豚”这一搜索词更加重视:
/Dolphins.php
than
/pages.php?page=1323
You'll find this is what most modern websites are doing (including *).
您会发现这是大多数现代网站正在做的事情(包括*)。
#3
Google's SEO Guide mentions a few tips regarding URLs under the "Improve the structure of your URLs" section.
Google的SEO指南在“改善网址结构”部分中提到了一些有关网址的提示。
#4
You can create .htaccess file in root of site and add this into file:
您可以在站点的根目录中创建.htaccess文件并将其添加到文件中:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/pages/(.*) pages.php?page=$1
#5
Check out this blog entry from google.
从谷歌查看此博客条目。
Specially this quote.
特别是这句话。
One recommendation is to avoid reformatting a dynamic URL to make it look static
一个建议是避免重新格式化动态URL以使其看起来是静态的
#6
It doesn't help the search engines find the page easier (in fact if not implemented properly it can make it harder for the search engines to crawl your site) but if done properly it will make your pages rank better for their relevant keywords
它无助于搜索引擎更容易找到页面(事实上,如果没有正确实施,它可能会使搜索引擎难以抓取您的网站)但如果操作正确,它会使您的网页在相关关键字中排名更高
For PHP look at mod_rewrite for Apache
对于PHP,请查看Apache的mod_rewrite
I'm not a regex expert but it uses pattern matching rules to perform the rewrite, there will be lots of documentation and tutorials online for mod_rewrite
我不是正则表达式专家,但它使用模式匹配规则来执行重写,mod_rewrite将有大量的在线文档和教程
#7
It won't help the search engines to find them more easily. To make sure the search engines find your pages, the two most important things you can do are:
它不会帮助搜索引擎更容易找到它们。为了确保搜索引擎找到您的网页,您可以做的两件最重要的事情是:
-
Create a sitemap, reference it in your robots.txt, and register it with Google WebMaster tools
创建站点地图,在robots.txt中引用它,并使用Google WebMaster工具进行注册
-
Make sure you actually have spiderable, non-javascript links (preferably text links) to all the pages on your site.
确保您的网站上的所有网页实际上都有可播放的非JavaScript链接(最好是文字链接)。
#8
The search engines will like your pages a lot more. If there is a dynamic file ending and a querystring, most search engines thinks it's a dynamic page, which will change soon, and therefore won't rank it as high as static pages.
搜索引擎会更喜欢您的网页。如果有动态文件结束和查询字符串,大多数搜索引擎认为它是一个动态页面,它将很快改变,因此不会像静态页面那样高。
Then you've got the rewrite in place, you can easily parse it in your PHP and decide your url structure with php.
然后你已经完成了重写,你可以在PHP中轻松解析它并用php决定你的url结构。
#9
Would like to emphasis the need for an extension to the page, e.g. .html and the fact that slashes inside the url are interpreted as virtual directory paths inside the site's "tree map".
想要强调对页面的扩展的需要,例如.html以及url中的斜杠被解释为站点“树形图”内的虚拟目录路径这一事实。
There is more "weight" as Keltex said in paths like category.html than /category/subcategory.html
Keltex在类似于category.html的路径中比/category/subcategory.html更多的“重量”
Anyways it is mandatory to implement the friendly urls along with a sitemap. All that combined with basic SEO title,proper headings gives you a nice result.
无论如何,必须实现友好的URL和站点地图。所有这一切加上基本的SEO标题,正确的标题给你一个很好的结果。
#10
For SEO purposes, it is best to include your keyword in the URL. However, if it's already a published page, make sure that you set up a redirect from the existing URL to the new URL before making the change. Nobody likes a broken link.
出于搜索引擎优化的目的,最好在URL中包含您的关键字。但是,如果它已经是已发布的页面,请确保在进行更改之前设置从现有URL到新URL的重定向。没有人喜欢断链。