Question

I'm unsure whether the following is correct considering I can't find a web example that targets a file inside a directory.

<FilesMatch "/out/index.php$">
Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>

is it ok that way or:

<FilesMatch "\out\index.php$">
Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>
Was it helpful?

Solution

First one is the right one as Apache like Unix systems uses forward slash for paths.

So the right one is:

<FilesMatch "/out/index\.php$">
    Header set X-Robots-Tag "noindex, nofollow"
</FilesMatch>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top