.htaccess - Apache mod_rewrite rule and forever loop -
i need rewrite files start "t" 1 directory directory.
from /gallery/txyz.ext
/gallery/thumbnails/thumbs_xyz.ext
i have problem rewriterule:
rewritecond %{request_filename} -f rewriterule ^gallery/t(.*)$ /gallery/thumbs/thumbs_$1 [r=301,nc,l]
because catches thumbs
directory again (starts "t") , forever loop occurs.
problem word thumbs
matches t*
pattern , caused redirection loop.
use rule fix it:
rewritecond %{request_filename} -f rewritecond %{request_uri} !^/gallery/thumbs/ [nc] rewriterule ^gallery/t(.*)$ /gallery/thumbs/thumbs_$1 [r=301,nc,l]
or else:
rewritecond %{request_filename} -f rewriterule ^gallery/t(?!humbs/)(.*)$ /gallery/thumbs/thumbs_$1 [r=301,nc,l]
Comments
Post a Comment