Currently, my .htaccess file looks like this:
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule /album2 /galleries/album2 [QSA,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule /album /galleries/album [QSA,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*\.exe)$ /slideshows/$1 [QSA,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) /photos/$1 [QSA,L]
That seems a bit messy to me because I repeat those checks for directories and files a lot. There must be a better way to do this.
What I am trying to accomplish is redirecting to different folders depending on if the file or folder being requested exists. Everything use to be in the root directory of the site, but that was becoming unmanageable. I’d like the script to basically check if these if files or folders exist in a few different directories and if they do, redirect to it.
All cleaned up, and a mint on your pillow 🙂