Forum Moderators: phranque

Message Too Old, No Replies

htaccess RewriteRule ok on one server not on another

htaccess RewriteRule ok on one server not on another

         

ocouno

6:31 pm on Mar 2, 2011 (gmt 0)

10+ Year Member



Hi not sure what the problem is but I am getting some strange results with some htaccess RewriteRules. I have been using them for ages on multiple servers / sites and it has always worked fine. Basically it checks if the user is trying to access the admin directory and if so sends them there and if not displays the client facing site.

Now on one of my clients server its ignoring the admin rules completely? But the weird thing is that if I comment out the latter set of rules the admin area comes up fine...


#################################
#
# ADMIN SECTION
#
#################################

RewriteRule ^admin/((.*)\.[0-9a-zA-Z]{2,3})$ admin/$1 [L]
RewriteRule ^admin/ admin/index.php [L]

#################################
#
# FRONTEND SECTION
#
#################################

RewriteRule public/((.*)\.(js|ico|gif|jpg|txt|png|pdf|css|flv|f4v|swf|xml|htc))$ public/$1 [L]
RewriteRule !\.(js|ico|gif|jpg|png|pdf|txt|css|flv|f4v|swf|xml|htc)$ public/index.php [L]
RewriteRule ^(.*)$ public/$1 [L]

g1smd

10:47 pm on Mar 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule ^admin/ admin/index.php [L]

can be replaced by:
DirectoryIndex index.php




In normal processing, mod_rewrite is invoked again until there are no further pattern matches. At least two of those lines result in an infinite loop, as the request is rewritten to a format which matches the rule again, and again, and again...