简体   繁体   English

强制将CSS文件指向PHP的RewriteRule放入包含.htaccess文件的子目录中

[英]Force a RewriteRule pointing CSS files to PHP, into sub-directories containing an .htaccess file

I have an .htaccess file in a folder redirecting all CSS and JS files to a php file. 我在文件夹中有一个.htaccess文件,它将所有CSS和JS文件重定向到一个php文件。

RewriteRule ^(.*\.(js|css)) process.php?file=$1

And it works fine into sub-directories as well, however I have a sub-directory containing an .htaccess file with: 它也可以很好地进入子目录,但是我有一个包含.htaccess文件的子目录,其中:

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

For the purpose of using "clean URLs" 为了使用“干净的URL”

How can I force this sub-directory to still send the CSS/JS files through what's defined in the parent directory? 如何强制该子目录仍然通过父目录中定义的内容发送CSS / JS文件?

I know I can manually do this for that sub-directory by placing exception within the sub-directory's .htaccess file - but can I do it any other way? 我知道我可以通过在子目录的.htaccess文件中放置异常来手动为该子目录执行此操作-但是我可以通过其他方法吗?

This is for distribution so it will be a hell of a lot easier if I can somehow force the parent RewriteRule into all sub-directories regardless. 这是为了分发,因此,如果我可以以某种方式强制将父RewriteRule放到所有子目录中,这将是一件容易的事。

Thanks for any suggestions! 感谢您的任何建议!

您可以尝试将此行放在RewriteEngine On下方的子目录.htaccess中:

RewriteOptions inherit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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