tags:

views:

38

answers:

2

If there is browse_by_exam or my_study_centre in the 1st position starting from project_name as in

http://project_name/browse_by_exam/type/classes/...
http://project_name/my_study_centre/page_sort/1,20,name,asc/...

Then apply these 2 rules:-

RewriteRule ^([a-zA-Z0-9\-\_]+)/?$ index.php?a=$1 
RewriteRule ^([a-z0-9\-\_]+)/([a-z0-9\-\_]+)/?$ index.php?a=$1&b=$2

For all other URLs apply these rules:-

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]

Thanks,

Sandeepan

A: 

None of these URLs are matched by the patterns of your two rules. But if you want to write rules that match your conditions, try a rule like this:

RewriteRule ^(browse_by_exam|my_study_centre)($|/) foobar [L]
Gumbo
Thanks for answering but I am not getting it clearly... if you could show with my example..
sandeepan
A: 

I found the solution myself. The following worked:-

############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

Cheers,

Sandeepan

sandeepan