Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTaccess在php重写和文件上相互冲突_Php_Apache_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

HTaccess在php重写和文件上相互冲突

HTaccess在php重写和文件上相互冲突,php,apache,.htaccess,mod-rewrite,redirect,Php,Apache,.htaccess,Mod Rewrite,Redirect,我的文件夹中有此原始.htaccess /subfolder/offer/dl AddType application/octet-stream .txt 其目的是在单击任何.txt扩展名时强制直接下载txt文件,例如 http://example.com/subfolder/offer/dl/1.txt 上面的url将下载txt文件,而不是在浏览器上显示 最近在文件夹提供中,我添加了以下.htaccess RewriteEngine On RewriteBase /subfolder/o

我的文件夹中有此原始.htaccess

/subfolder/offer/dl

AddType application/octet-stream .txt
其目的是在单击任何.txt扩展名时强制直接下载txt文件,例如

http://example.com/subfolder/offer/dl/1.txt 
上面的url将下载txt文件,而不是在浏览器上显示

最近在文件夹提供中,我添加了以下.htaccess

RewriteEngine On
RewriteBase /subfolder/offer/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ index.php?action=$1 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?action=$1&action_id=$2 [L,QSA]
现在由于这个.htaccess,我上面的.htaccess for/dl文件夹无法工作,它无法下载或链接到该文件


我应该更改什么才能使这两种方法都起作用。

您只需添加一条规则即可忽略
/dl/
文件夹中的所有请求:

RewriteEngine On
RewriteBase /subfolder/offer/

RewriteCond %{REQUEST_URI} /dl/ [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^([^/]+)/?$ index.php?action=$1 [QSA,L]

RewriteRule ^([^/]+)/([^/]+)/?$ index.php?action=$1&action_id=$2 [L,QSA]