Set header conditionally if certain word present in the url - htaccess
You can set headers conditionally if certain word present in the URL using .htaccess. This can be completed by using the Header directive and the "IF" conditional directive.
Below is the sample to conditionally set header
Below is the sample to conditionally set header
<If "%{THE_REQUEST} !~ m#s/+user[/?s]#"> Header set X-Content-Type-Options nosniff </If>In the above sample, "X-Content-Type" will be set if the word "user" present in the URL.
Comments (0)