Sunday, 15 September 2013

php - Include folders with .htaccess -



php - Include folders with .htaccess -

let's user goes address domain.com/test.php

is possible how if file test.php don't exist include other file located elsewhere on server?

im thinking if webroot located @ /home/user/www/:

rewritecond %{request_filename} -f [nc,or] include: /var/otherdir/test.php

edit: /var/otherdir/ local path

and if file doesn't exist in other folder first throw e:404.

would appreciate help.

you can following:

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^test.php$ /other/dir/test.php [l]

if file test.php exists on server shown. if not exists, there redirect /other/dir/test.php. if file not exists, 404 error shown.

php .htaccess include apache2 server-side-includes

No comments:

Post a Comment