SheppardDigital
asked on
.htaccess redirect if file exists
Hi,
I'm hoping this is an easy one but I can't figure it out.
Here's my current .htaccess file
On these lines,
RewriteRule ^public/(.*) app/routes/public/www/$1 [L]
RewriteRule ^admin/(.*) app/routes/admin/www/$1 [L]
How do I set these to only redirect if the requested file actually exists at the new location? Otherwise continue to process the rest of the .htaccess file?
Bascially, I don't want to redirect /admin/ to app/roues/admin/www/ but /admin/css/style.css should redirect to app/routes/admin/www/css/s tyle.css ok as it's an actual file.
I'm hoping this is an easy one but I can't figure it out.
Here's my current .htaccess file
RewriteEngine on
# do not do anything for already existing files
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
# Handle redirection to routes
RewriteRule ^public/(.*) app/routes/public/www/$1 [L]
RewriteRule ^admin/(.*) app/routes/admin/www/$1 [L]
# Handle framework requests
RewriteRule ^(.*)$ framework/index.php$1 [L]
On these lines,
RewriteRule ^public/(.*) app/routes/public/www/$1 [L]
RewriteRule ^admin/(.*) app/routes/admin/www/$1 [L]
How do I set these to only redirect if the requested file actually exists at the new location? Otherwise continue to process the rest of the .htaccess file?
Bascially, I don't want to redirect /admin/ to app/roues/admin/www/ but /admin/css/style.css should redirect to app/routes/admin/www/css/s
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.