删除尾部斜杠,强制索引

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了删除尾部斜杠,强制索引相关的知识,希望对你有一定的参考价值。

Removes trailing slashes from URLs, forces all urls to index.php
  1. RewriteCond %{http_host} ^MyExample.com [nc]
  2. RewriteRule ^(.*)$ http://www.MyExample.com/$1 [r=301,nc,L]
  3.  
  4. RewriteBase /
  5.  
  6. RewriteCond %{REQUEST_FILENAME} !-d
  7. RewriteRule ^(.+)/$ /$1 [R=301,L]
  8.  
  9. RewriteCond %{REQUEST_FILENAME} !-f
  10. RewriteCond %{REQUEST_FILENAME} !-d
  11. RewriteRule . /index.php [L]

以上是关于删除尾部斜杠,强制索引的主要内容,如果未能解决你的问题,请参考以下文章

使用 .htaccess 删除尾部斜杠

如果 tagdir 属性没有尾部斜杠,是不是有任何 jsp 2.0 实现强制出错?

删除尾部斜杠重定向循环

从每个参数中删除尾部斜杠的最简单方法是啥?

mod_rewrite:删除尾部斜杠(只有一个!)

从批处理文件输入中删除尾部斜杠