如果从browse_by_exam
开始的第一个位置有my_study_centre
或project_name
,则
http://project_name/browse_by_exam/type/classes/...
http://project_name/my_study_centre/page_sort/1,20,name,asc/...
然后应用这两条规则: -
RewriteRule ^([a-zA-Z0-9\-\_]+)/?$ index.php?a=$1
RewriteRule ^([a-z0-9\-\_]+)/([a-z0-9\-\_]+)/?$ index.php?a=$1&b=$2
对于所有其他网址,请应用以下规则: -
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
谢谢,
Sandeepan
答案 0 :(得分:1)
我自己找到了解决方案。以下工作: -
############Following rules apply only to browse_by_exam and my_study_centre
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 ^(browse_by_exam|my_study_centre)
RewriteRule ^(.*)$ index.php [L,QSA]
#################################################
###Following rules apply to all other pages (other than browse_by_exam and my_study_centre)
RewriteRule ^([a-zA-Z0-9\-\_]+)/?$ index.php?a=$1
RewriteRule ^([a-z0-9\-\_]+)/([a-z0-9\-\_]+)/?$ index.php?a=$1&b=$2
RewriteRule ^([a-z0-9\-\_]+)/([a-z0-9\-\_]+)/([a-zA-Z0-9\-\_+]+)/?$ index.php?a=$1&b=$2&c=$3
RewriteRule ^([a-z0-9\-\_]+)/([a-z0-9\-\_]+)/([a-zA-Z0-9\-\_+]+)/([0-9]+)/?$ index.php?a=$1&b=$2&c=$3&d=$4
干杯,
Sandeepan
答案 1 :(得分:0)
这些网址中没有一个与您的两条规则的模式相匹配。但是,如果您想编写符合条件的规则,请尝试以下规则:
RewriteRule ^(browse_by_exam|my_study_centre)($|/) foobar [L]