重写文件夹并删除末尾的尾部斜杠

I'm trying to have only one URL without the trailing slash at the end of the URLs/folders, but at the same time I want to re-write this folder to use dynamic pages, for example:

if I have:

mydomain.com/folder
mydomain.com/folder/

and

mydomain.com/folder/second
mydomain.com/folder/second/

then I want to open only "mydomain.com/folder" and "mydomain.com/folder/second" and this URLs should open a dynamic pages. This is what I am trying, but it does not work, it crash my page:

RewriteEngine On
RewriteRule ^(.*)/$   /$1 [L]
RewriteRule ^(.*)$    includes/category.php?url=$1&pageType=category [L] 

RewriteRule ^(.*)/(.*)/$  /$1/$2 [L]
RewriteRule ^(.*)/(.*)$   includes/subcategory.php?url=$1&pageType=subCategory [L] 

What am I doing wrong? can you help me to run the right syntax please?

查看全部
douyi5822
douyi5822
2015/06/13 19:49
  • apache
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复