使用htaccess重定向目录,但不重定向其中的文件

sai*_*ish 1 html apache .htaccess redirect

在我的网站上,我有一个目录/文件夹,里面有一些图片和HTML.我想将尝试访问http://domain.com/folder的用户重定向到http://domain.com/,但不希望请求将该目录中的文件重定向到http://domain.com/无论是.当我尝试

Redirect /folder http://domain.com/
Run Code Online (Sandbox Code Playgroud)

它打破了网站,因为现在它认为所有图像等都不在根目录中.我该如何解决?

Gum*_*mbo 5

RedirectMatch改为使用:

RedirectMatch ^/folder$ http://example.com/
Run Code Online (Sandbox Code Playgroud)

现在URI路径必须完全匹配/folder.