gpt4 book ai didi

html - 最好的处理方式包括在子目录中?

转载 作者:行者123 更新时间:2023-11-28 13:25:34 24 4
gpt4 key购买 nike

抱歉,如果这一点不清楚。基本上,我已经用 PHP 创建了一个小型 MVC 框架。一切正常,但我只是试图将应用程序移动到站点根目录的子目录中,它破坏了一切。我预料到了这一点,因为我在引用 css/js 文件时一直在引用 /public/... 。文件结构如下所示:

/local/www/dev/ (web root)
ref/
application/
controllers/
views/
config/
system/
public/
js/
css/
index.php (handles all requests)

有两个.htaccess 文件。 ref 中的一个:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^$ public [L]
RewriteRule (.*) public/$1 [L]
</IfModule>

还有一个在ref/public

 <IfModule mod_rewrite.c>
RewriteEngine On

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

RewriteRule ^(.*)$/? index.php?url=$1 [PT,L]

</IfModule>

当我转到 http://test.dev/ref/leads/5 时,源试图找到以前有效的 /css/style.css,但现在它不在子目录中(很明显。)无论如何我可以相对包含静态文件吗?也许使用 htaccess?

最佳答案

~”应该带你回到 root。所以试试这个:

~/ref/public/css/style.css 引用您的 CSS 文件时。

关于html - 最好的处理方式包括在子目录中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14219470/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com