开发者

dont apply normal redirect rule if call is from a specific subdomain

开发者 https://www.devze.com 2023-01-24 11:53 出处:网络
I have a subdomain which is added as a serverAlias to 开发者_JAVA技巧the main domain. I am using this subdomain only for static content such as images and js, so I dont want the subdomain to follow re

I have a subdomain which is added as a serverAlias to 开发者_JAVA技巧the main domain. I am using this subdomain only for static content such as images and js, so I dont want the subdomain to follow rewrite rules and load index.php if a file is not found, I want it to show generic 404 page which is default from the server


I wanted not to apply the rule for my subdomain, this code worked for me

modifying bradym's block as example

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^static.example.com$ [NC]
RewriteRule (.*) - [R=404,L]


Something like this should work:

RewriteEngine On
RewriteCond %{HTTP_HOST} static.example.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) - [R=404,L]
0

精彩评论

暂无评论...
验证码 换一张
取 消