Unable to set root directory headers with htaccess, 1and1

My issue is that I cannot move my .htaccess file one directory back eg ../ due to hosting limitations...

Here is my .htaccess

Options -Indexes

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?gw2pvp.com$
RewriteCond %{REQUEST_URI} !/main/
RewriteRule (.*) /main/$1 [L]

Header always set X-FRAME-OPTIONS "DENY"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Content-Type-Options "nosniff"
Header always set Content-Security-Policy "script-src 'self' //ajax.googleapis.com"

What this is doing is setting /main as the root directory, so that when i goto the main website my files in /main are shown instead.

The issue here is that my headers won't set now. Is there anyway to trick it into setting headers here?

My website: http://gw2pvp.com loading http://gw2pvp.com/sdgshsg will load correct headers.... (non existant directory) going into http://gw2pvp.com/main/ doesn't work either.

i guess this rules out the possibility of cloudflare being the issue, and also that the directives work in htaccess.

one thing i noticed is that it works for everything but PHP files...

eg http://gw2pvp.com/main/test.html works.

this would indiciate that this is working fine and something else is not letting me set headers here..


Try these rules:

Options -Indexes
RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?stackoverflow.com$
RewriteCond %{REQUEST_URI} !/forum/
RewriteRule (.*) /forum/$1 [L]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule ^ - [F,L]

%{HTTP_HOST} matches only hostname without protocol or scheme.

链接地址: http://www.djcxy.com/p/58932.html

上一篇: 在本地和远程Apache服务器上设置PHP错误

下一篇: 无法使用htaccess,1and1设置根目录标头