apache - Htaccess - Check if file exists after url rewriting -


i've created rule:

rewritecond %{request_filename} !-f rewriterule ^([a-za-z0-9_-]+)/account/(.*)$ accounts/$1/$2 [nc,l] 

to point address this: example.com/john/account/img/1.jpg example.com/accounts/john/img/1.jpg , works.

i know how make rule if url phisical file not exists.

but want, after rule, set folder default images (or other file types). referring example, want show image example.com/default/img/1.jpg (or directly example.com/img/1.jpg) if image not exists in "john" folder (example.com/accounts/john/img/1.jpg).

how can do?

try these rules:

# image doesn't exist in /accounts/john/<img> rewritecond %{request_filename} !-f rewritecond %{document_root}/accounts/$1/$2 !-f rewriterule ^([\w-]+)/account/(.+)$ default/$2 [nc,l]  rewritecond %{request_filename} !-f rewritecond %{document_root}/accounts/$1/$2 -f rewriterule ^([\w-]+)/account/(.+)$ accounts/$1/$2 [nc,l] 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -