I want to redirect a nonexistent virtual folder when it is directly accessed to the root domain but not files from within it. How to get this? Right now I can only redirect the full directory, including all files, to the domain with this in my .htaccess file:

RedirectMatch 301 /features http://example.org/
有帮助吗?

解决方案

The redirect is incorrect, should be:

RedirectMatch 301 ^/features/?$ http://example.org/

So you'll match only the path and not the files. Consider also that with this solution the slash after the directory features is optional.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top