Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex .htaccess不是';t正确处理文件夹的根目录_Regex_.htaccess - Fatal编程技术网

Regex .htaccess不是';t正确处理文件夹的根目录

Regex .htaccess不是';t正确处理文件夹的根目录,regex,.htaccess,Regex,.htaccess,因此,我在我的Web服务器的/blog/文件夹中有这个.htaccess文件,为了使用我们用于这个特定客户端(表达式引擎)的博客CMS,我编写了这个.htaccess,以使URL SEO友好。这一切都很好,除非我去www.example.com/blog/然后它就进入了我不想要的底线 我试着在最后一行的第二行添加Google行,看看它到底检测到了什么,它通过Google“index.html”(没有引号)——可能有一种简单的正则表达式方法来排除以index.html开头的字符串,但不幸的是,我不

因此,我在我的Web服务器的/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/

您可以将以下规则设置在其他规则之上,以从其他规则中排除
/index.html

RewriteRule ^index\.html$ - [L]

事实证明,我必须对index.cgi、index.pl和index.php执行同样的操作