Forum Moderators: phranque
I am using some rewrite rules e.g
ewriteCond %{REQUEST_URI} ^/.*$
RewriteRule ^([^.]+)/([^.]+)/([^.]+)\.html$ show_pages.php?page_url=$3&mode=subcatpage [L]
RewriteCond %{REQUEST_URI} ^/.*$
RewriteRule ^([^.]+)/([^.]+)/$ show_pages.php?sub_cat_name=$2&mode=subcatindex [L]
The rules are working fine however if I write
[http://][www.]example.com[/][index.php]
all matches of the above generates error because the rules are standing true
because i redirect URLs like
example.com/somevalue page.php?value=somevalue
therefore even in case of index.php it uses this rule to find the value...
How can I fix this problem so that if I write only my domain name or domain name and index.php with it it should only open the index.php page and no other page
thanks
RewriteRule ^([^/]+)/([^/]+)/([^.]+)\.html$ show_pages.php?page_url=$3&mode=subcatpage [L]
#
RewriteRule ^([^/]+)/([^/]+)/$ show_pages.php?sub_cat_name=$2&mode=subcatindex [L]
Jim
thanks for your reply, in fact the problem was not htaccess but my php code I have fixed that code.
Can you please shed some light why your suggest rules are better for performance than mine? because my rules work but of course they must be improved.. just wanted to get the concept so that in future I can write more efficient rules
thanks
And the RewriteRule patterns were incorrect, forcing the matching engine to try several times to find a match. To understand this, it is necessary to fully-understand the patterns that you used, and the patterns that I suggest; See the regular-expressions documentation cited in our forum charter [webmasterworld.com].
Jim