首页 \ 问答 \ 使用rel =“next”rel =“prev”HTTP标头的分页SEO(SEO of Pagination using rel=“next” rel=“prev” HTTP Headers)

使用rel =“next”rel =“prev”HTTP标头的分页SEO(SEO of Pagination using rel=“next” rel=“prev” HTTP Headers)

我试图在网站上的分页控件上执行一些搜索引擎优化。

遵循Google指南 ,我想将链接rel = next / prev即<link href="/search/results?page=2" rel="next" />到我的搜索结果页面的<head>

不幸的是,由于MVC3的设计决策/限制以及渲染部分和在Partials中定义其内容 ,我无法做到这一点。

所以我的问题是 - 我可以通过添加“链接”HTTP标头来复制上述功能,即Link: <http://www.example.com/search/results?page=2>; rel="next" Link: <http://www.example.com/search/results?page=2>; rel="next"到响应,因此不必在<head>添加<link>标签?


I am trying to perform some SEO on a pagination control I have on a website.

Following the Google guidelines, I would like to add link rel=next/prev i.e. <link href="/search/results?page=2" rel="next" /> to the <head> of my search results page.

Unfortunatley, due to a design decision / limitation of MVC3 with rendering sections and defining their content within Partials, I'm unable to do this.

So my question is - can I replicate the aforementioned functionality by adding a "Link" HTTP header, i.e. Link: <http://www.example.com/search/results?page=2>; rel="next" to the response and therefore not have to add the <link> tags in the <head>?


原文:https://stackoverflow.com/questions/7586361
更新时间:2023-11-02 22:11

最满意答案

改用microtime(true)

$time = microtime(true);
$micro = $time - floor($time); // microseconds part

Use microtime(true) instead.

$time = microtime(true);
$micro = $time - floor($time); // microseconds part

相关问答

更多
  • E-5是科学记数法。 似乎在将它与字符串值连接时发生。 尝试使用number_format ...? print "Time4: ". number_format($end4 - $start4, 10)."
    "; //or use: printf(".10f", $end - $start) E-5 is scientific notation. Seems to happen when you concatenate it with the string val ...
  • 在PHP中, microtime实际上为您提供了微秒分辨率的一秒。 JavaScript使用毫秒而不是秒作为其时间戳,因此您只能获得具有毫秒分辨率的分数部分。 但要得到这个,你只需要取时间戳,除以1000并得到余数,如下所示: var microtime = (Date.now() % 1000) / 1000; 为了更完整地实现PHP功能,您可以执行以下操作(从PHP.js缩写 ): function microtime(getAsFloat) { var s, now = (D ...
  • 改用microtime(true) 。 $time = microtime(true); $micro = $time - floor($time); // microseconds part Use microtime(true) instead. $time = microtime(true); $micro = $time - floor($time); // microseconds part
  • 如果要对由microtime返回的操作进行操作,则必须将“get as float”参数设置为true(默认为false)。 http://www.php.net/manual/en/function.microtime.php $now = microtime(true); for (...) { // do something echo microtime(true) - $now; $now = microtime(true); } If you want to do ope ...
  • 即使需要几微秒(是的,它的文件必须被解析,对吗?!),你不应该删除它们。 首先要做的是缓存字节代码,因此PHP解释器不必将“纯文本”代码重新解析为字节代码。 我认为你可以从中获得更多的性能提升,而不是担心评论会占用解析时间。 这个帖子似乎确实是重复的 。 (请注意自己,首先在提交前刷新页面。) Even if it takes some microseconds (yes it will, your file has to be parsed, right?!), you shouldn't remove ...
  • 没有直接的等价物,但可以很容易地实现......由于UNIX时间戳是自1970年1月1日以来的秒数,因此很容易计算: public readonly DateTime UnixEpoch = new DateTime(1970, 1, 1); // equivalent to PHP mktime : public int GetUnixTimestamp(DateTime dt) { TimeSpan span = dt - UnixEpoch; return (int)span.Tot ...
  • microtime - 以微秒为单位返回当前的Unix时间戳 混合microtime([bool $ get_as_float = false]) 改为: $time = microtime(true); echo microtime(true) - $time; 结果将在几秒钟内完成。 检查此(手动): 'time1'=>浮动1360860136.6731 'time2'=>浮点数1360860136.6732和 'time2' - 'time1'= 9.9897384643555E-5即0.00009 ...
  • 浮点数中显示的位数由PHP.ini文件中的精度设置控制。 它的默认值是14 ,这正是你在下面看到的位数: 1419714319.0506 // 10 digits before, 4 after decimal, 14 total 将此设置更改为更大的数字:: ini_set("precision", 20); $t = microtime(true); var_dump($t); // float(1419716734.0712089539) 请注意,这只能控制显示的位数,不会影响计算。 说了这么多, ...
  • 没有使用日期格式化程序的解决方案 - 自己完成所有操作: $minutes = floor($time / 60); $seconds = $time % 60; $minutes = str_pad($minutes, 2, '0', STR_PAD_LEFT); $seconds = str_pad($seconds, 2, '0', STR_PAD_LEFT); echo "Process Time: $minutes:$seconds"; 注意:如果分钟数等于或大于60,这也有效。即使您的分钟 ...
  • 你在说什么是剖析。 虽然可以“自己动手”,(并且你在这方面走的是正确的道路),但是有很多有用的东西会为你做繁重的工作。 如果你愿意,你可以随时做你建议的事情并通过循环测试的多次迭代来消除偏差,但是如果你想全面分析你的所有PHP我推荐这个问题的“xdebug”答案: 最简单的方法配置PHP脚本 它对我很有用。 What you are talking about is profiling. Although it is possible to "roll your own", (and you are on ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)