CodeIgniter Forums
htaccess question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: htaccess question (/thread-6535.html)



htaccess question - El Forum - 03-03-2008

[eluser]Hyra[/eluser]
Afternoon,

I've got a controller that's called "browse.php" and one of its methods is "limit".

Basically i was wondering why the following works:

[pre]
RewriteEngine on

RewriteBase /

#BROWSE Portions
RewriteCond %{HTTP_HOST} browse\.ai\.com [NC]
RewriteRule ^([0-9]*)/$ /index.php?c=browse&m=limit&offset;=$1 [L]
RewriteRule ^([a-z]*)/$ /index.php?c=browse&m=limit&cat;=$1 [L]
RewriteRule ^([a-z]*)/([0-9]*)/$ /index.php?c=browse&m=limit&cat;=$1&offset;=$2 [L]
RewriteRule ^([a-z]*)/([a-z]*)/$ /index.php?c=browse&m=limit&cat;=$1&subcat;=$2 [L]
RewriteRule ^([a-z]*)/([a-z]*)/([0-9]*)/$ /index.php?c=browse&m=limit&cat;=$1&subcat;=$2&offset;=$3 [L]

RewriteRule ^$ /browse/ [L]
[/pre]

And the following doesn't
[pre]
RewriteEngine on

RewriteBase /

#BROWSE Portions
RewriteCond %{HTTP_HOST} browse\.ai\.com [NC]
RewriteRule ^([0-9]*)/$ /browse/limit/?offset=$1 [L]
RewriteRule ^([a-z]*)/$ /browse/limit/?cat=$1 [L]
RewriteRule ^([a-z]*)/([0-9]*)/$ /browse/limit/?cat=$1&offset;=$2 [L]
RewriteRule ^([a-z]*)/([a-z]*)/$ /browse/limit/?cat=$1&subcat;=$2 [L]
RewriteRule ^([a-z]*)/([a-z]*)/([0-9]*)/$ /browse/limit/?cat=$1&subcat;=$2&offset;=$3 [L]

RewriteRule ^$ /browse/ [L]
[/pre]

The second one breaks when introducing the 3rd rule, and the other ones behave unexpectedly.

I don't have problems with using the first method, as it works fine. But i _am_ quite curious why the 2nd method doesn't work Smile