Question

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/
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top