Last (L) mod_rewrite



  • It's a good time for a colleague, the question is the next. ♪ ♪

    I have the following rule:

    RewriteRule ^.*$ public/index.php [L]

    It's a rule that redirects all queries to the front counterer... There's no problem here, and everything works wonderfully. The problem, for some reason, came after attempting to add specific rules for folders, js, img. ♪

    In fact, finish the rule (natural in front of the counter-aller front rule)

    RewriteRule ^img\/(.*)$ public/img/$1 [L]
    

    But anyway, the request goes to the front counterer... In doing so, if you remove the rule for the counteraller front, the rule works as it should. ♪ ♪
    What's interesting is... If you rewrite the rule for pictures like this:

    RewriteRule ^img\/(.*)$ public/?lol=public/img/$1 [L]
    

    That's how it works and the "primary" rule doesn't work, that is, it really comes $_GET['lol']... Please help me figure out what's going on here, or I don't have a roof going fast. ♪ ♪



  • Do you want to add a rule to a...htaccess?

    If not, use something like:

    RewriteEngine on
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?route=$1 [L,QSA]
    

    Or do you want to give the sss and whatever you want through the violin?

    UPD

    There are no brackets.

    RewriteRule ^.*$ public/index.php [L]

    that means FORTH Request redirected to public/index.php

    And now about Flag L:

    Флаг [L] останавливает текущую итерацию обработки запроса. Однако если запрос был изменен теми RewriteRule, которые все-таки успели отработать, Apache запустит цикл обработки запроса заново с первого RewriteRule.

    i.e. redirected from / to /public/index.php

    But the problem is that /public/index.php also falls under the mask.* and it is cycling. I didn't reindeer and I did it. Log:

    [Mon Nov 14 17:20:49 2011] [error] [client 10.222.22.14] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. [Mon Nov 14 17:20:49 2011] [debug] core.c(3067): [client 10.222.22.14] r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /web/fg.shurik.local/html/public/index.php [Mon Nov 14 17:20:49 2011] [debug] core.c(3073): [client 10.222.22.14] redirected from r->uri = /

    UPD2

    I suggested for the statistics to indicate a real physical path, i.e. /public/css/style.css... and the fashion_revwright will give us this file without RewriteCond.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2