【发布时间】:2010-10-03 15:36:05
【问题描述】:
所以我在我的网络服务器上的 /blog/ 文件夹中有这个 .htaccess 文件,并与我们用于这个特定客户端(表达式引擎)的博客 CMS 一起工作,我编写了这个 .htaccess 以使 URL SEO 友好。这一切都很好,除非我去 www.example.com/blog/ 然后它会通过我不希望它的底部规则。
我尝试添加您可以在最后一行第二行看到的 Google 行,以查看它检测到的具体内容并通过 google“index.html”(无引号)——可能有一种简单的正则表达式方法来排除开头的字符串使用 index.html 但不幸的是我不是正则表达式忍者...
这是 .htaccess 的内容:
rewriteengine on
##############################
# BLOG CATEGORIES HOME
rewriterule ^beach-baby/?$ index.php/site/C4/
rewriterule ^adventure-baby/?$ index.php/site/C5/
rewriterule ^snow-baby/?$ index.php/site/C6/
rewriterule ^wild-child/?$ index.php/site/C7/
##############################
# BLOG CATEGORIES WITH PAGE NUMBER
rewriterule ^beach-baby/page([0-9]+)/?$ index.php/site/C4/P$1/
rewriterule ^adventure-baby/page([0-9]+)/?$ index.php/site/C5/P$1/
rewriterule ^snow-baby/page([0-9]+)/?$ index.php/site/C6/P$1/
rewriterule ^wild-child/page([0-9]+)/?$ index.php/site/C7/P$1/
##############################
# BLOG INDEX WITH PAGE NUMBER
rewriterule ^page([0-9]+)/?$ index.php/P$1/
##############################
# BLOG POST
#rewriterule ^([^/]+)/?$ http://www.google.ca/search?q=$1
rewriterule ^([^/]+)/?$ index.php/site/comments/$1/
【问题讨论】: