简体   繁体   中英

Apache RequestHeader Directive in .htaccess

I am trying to use the following apache configuration on a Godaddy shared hosting account:

<Files ~ ".*">
<IfModule mod_headers.c>
RequestHeader unset Host
RequestHeader append Host mydomain.com
</IfModule>
</Files>

The above is contained in a .htaccess file. In other words... For all files and paths set the request's host to mydomain.com

The above doesn't seem to work. I get a 500 error on Godaddy's servers.

Thanks muchly!

The answer to this question was provided by Gumbo in the comments above

I rather think that your pattern is incorrect. If using mod_rewrite in a .htaccess file, the path prefix is being removed before applied to the pattern. Thereby “/foo/bar” is converted to “foo/bar” (if the .htaccess file is in the root “/”). So remove the leading slash from the pattern. – Gumbo Feb 23 at 14:29

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM