我正在尝试将目录2(/directory1/directory2/
)中的所有内容(PDF文件除外)重定向到静态URL。这可能吗?
答案 0 :(得分:2)
是的,这是可能的。将此代码放在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]