【发布时间】:2021-11-05 14:27:51
【问题描述】:
您好,我有一个应用程序应该使用 3 个参数来过滤 url - 模块 / 视图 / Id - 但是,必须添加基本 html 标记来整理 css/jss url 文件,但现在我有一个由于 htacccess 的重定向而导致 css/jss 文件未加载的问题。
Htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Module
RewriteRule ^([^/]+)/?$ index.php?module=$1 [NC,L]
# Module/View
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?module=$1&view=$2 [NC,L]
# Module/View/Id
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?module=$1&view=$2&id=$3 [NC,L]
Options +Indexes
Options +FollowSymlinks
头文件:
<base href="http://localhost/mycbsv2/">
<!--begin::Fonts-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" />
<!--end::Fonts-->
<!--begin::Global Stylesheets Bundle(used by all pages)-->
<link href="assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css" />
<link href="assets/css/style.bundle.css" rel="stylesheet" type="text/css" />
<!--end::Global Stylesheets Bundle-->
问题是,如果您转到 css 文件 url,它不会加载它,因为它正在将文件作为模块搜索(因为 url)...
有没有办法在搜索文件时添加一个例外来不过滤url?
这个问题也可能出现,因为应用程序的所有视图都是从 index.php 文件管理的。
【问题讨论】: