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
Post a Comment