I’ve read some .htaccess tutorials but can’t figure out this easy task.
I have a site that typically routes every request to index.php.
But I have one specific file (upload_photo.php) that I want it to simply execute without rerouting to index.php. Below is my htacess file with an entry for upload_photo.php that screws up everything. What am I doing wrong?
# AddType x-mapp-php5 .php
# AddHandler x-mapp-php5 .php
RewriteEngine on
Options +FollowSymlinks
#Options +SymLinksIfOwnerMatch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule upload_photo.php upload_photo.php [L]
RewriteRule . index.php [L]
ErrorDocument 404 /page-unavailable/
<files ~ "\.tpl$">
order deny,allow
allow from none
deny from all
</files>
The original rewrite you had:
does something like this:
Configuration:
if the path requested is not a file
if the path requested is not a directory
then rewrite to index.php
So, if your file
upload_photo.phpreally exist in same directory whereindex.phpis, you don’t need to change the original rewrite.The correct file .php will be referenced automatically, because the rewrite to index.php will be executed only if the requested resource (file or directory) does not exist.
So there is no need to add this: