配置htaccess的绕过直接链接到CSS和JavaScript文件 [英] Configure htaccess to bypass direct links to CSS and Javascript Files
本文介绍了配置htaccess的绕过直接链接到CSS和JavaScript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在开发一个小型的框架,它采用的是htaccess的文档,它把所有流量从公共文件夹到另一个文件夹。但香港专业教育学院认识到,它也重定向所有直接链接到图片,CSS和脚本。
I am currently developing a mini framework which uses a htaccess doc which redirects all traffic from the public folder to another folder. But Ive realized that it also redirects all direct links to images, css and scripts.
我不那么熟悉的htaccess code,我怎样才能把这些异常在这个htaccess的code
I am not that familiar with htaccess code, how can I put those exceptions in this htaccess code
RewriteEngine on
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?cmd=$1 [PT,L]
在此先感谢
推荐答案
您无法路由的一切公共/
和的index.php
在同一时间。你可能想在这个规则你的的DocumentRoot /的.htaccess
:
You cannot route everything to public/
and index.php
at the same time. You probably want this rule in your DocumentRoot/.htaccess
:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
这篇关于配置htaccess的绕过直接链接到CSS和JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文