HTaccess在php重写和文件上相互冲突
我的文件夹中有此原始.htaccess /subfolder/offer/dlHTaccess在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
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]