Reputation: 518
I'm trying to redirect everything in directory2 (/directory1/directory2/
) except for PDF files to a static URL. Is this possible?
Upvotes: 1
Views: 394
Reputation: 785128
Yes it is possible. Place this code in root .htaccess
:
RewriteEngine On
# it doesn't end with .pdf
RewriteCond %{REQUEST_URI} !\.pdf
# URI starts with /directory1/directory2 then redirect
RewriteRule ^directory1/directory2/(.*)$ /some-where/$1 [L,NC,R]
Upvotes: 2