php - .htaccess Rewrite problems -


either need go school desk, or there weird going on.

the following doesn't work, real physical files , directories not resolve:

<ifmodule mod_rewrite.c>   options +followsymlinks   rewriteengine on   rewritebase /   rewritecond %{request_filename} !-d   rewritecond %{request_filename} !-f   rewritecond %{request_filename} !-l    # following rule must not affect real physical files,   rewriterule ^(img/.*)$ http://old.site.com/$1 [l,r=301]    rewriterule .* index.php [l] </ifmodule> 

however piece of code works , resolves real files , folders fine:

<ifmodule mod_rewrite.c>   options +followsymlinks   rewriteengine on   rewritebase /   rewritecond %{request_filename} !-d   rewritecond %{request_filename} !-f   rewritecond %{request_filename} !-l    rewriterule ^(img/.*)$ http://old.site.com/$1 [l,r=301]    rewritecond %{request_filename} !-d   rewritecond %{request_filename} !-f   rewritecond %{request_filename} !-l    rewriterule .* index.php [l] </ifmodule> 

do need new rewritecond preceeding each , every rewriterule?

rewritecond applicable next rewriterule. yes in case need rewritecond preceeding each , every rewriterule.

but news can avoided.

if want avoid writing these multiple rewritecond can code:

## if request valid directory rewritecond %{request_filename} -d [or] ## if request valid file rewritecond %{request_filename} -f [or] ## if request valid link rewritecond %{request_filename} -l ## don't rewriterule ^ - [l]  rewriterule ^(img/.*)$ http://old.site.com/$1 [l,r=301]  rewriterule .* index.php [l] 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -