Apache 是否可以为特定域设置.htaccess规则?

Apache 是否可以为特定域设置.htaccess规则?,apache,.htaccess,mod-rewrite,add-type,Apache,.htaccess,Mod Rewrite,Add Type,是否有办法使AddType命令仅适用于某些主机 具体来说:AddType x-httpd-php54.php 对于不同的域有不同的RewriteRule定义有很多问题,你可以用RewriteCond来解决,但是对于非重写相关的东西有没有一个等价物呢?你可以这样使用: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)somdomain\. [NC] RewriteRule \.php$ - [T=application/x-httpd-php5

是否有办法使
AddType
命令仅适用于某些主机

具体来说:
AddType x-httpd-php54.php

对于不同的域有不同的
RewriteRule
定义有很多问题,你可以用
RewriteCond
来解决,但是对于非重写相关的东西有没有一个等价物呢?

你可以这样使用:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)somdomain\. [NC]
RewriteRule \.php$ - [T=application/x-httpd-php54]

这应该是
RewriteRule\.php$-[T=application/x-httpd-php54]
?是的,它应该只为
.php
文件设置。修正了,很抱歉我错过了。太快了!但是我担心它不起作用:(你是说它在没有
.php
的情况下工作,但不再工作了?我的投票和接受都有点过早,在这两种情况下都不起作用