.htaccess - Mod Rewrite: I want to redirect all requests to index page unless the file exists (but not if the file is a php file) -
i have .htaccess file right now. sends index page unless wanted real file. sort of want, dont want able access .php file. have:
rewriteengine on rewritecond %{request_filename} !-f [nc] rewriterule ^(.*) /index.php [nc]
but want:
if(file_exists(request) && !request.endswith(".php")) not redirect request else redirect index page
this tried:
rewriteengine on rewritecond %{request_filename} !-f [nc] rewriterule !(\.php)$ /index.php [nc]
but if type in real location of php file, still tries load it. can add few lines top of every single php file asking php_self is. if php_self isnt index.php, redirect them index page. think .htacess can better.
i think need tolook @ custom 404 (file not found) redirect rather checking if file exists
Comments
Post a Comment