gpt4 book ai didi

php - .htaccess 重定向,MIME 错误

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

我正在尝试像这样重定向 URL

http://localhost/web/gallery/dogs

http://localhost/web/index.php?section=gallery&name=dogs

为此,我尝试使用下一个 .htaccess

RewriteBase /

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^gallery/(.*)$ index.php/?section=gallery&name=$1 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?section=$1 [L]

</IfModule>

我有下一个问题,如果我手动编写 URL,使用正确的 CSS 看起来很好并且没有错误。否则,如果我使用第一个 URL,firefox 会给我 CSS 和其他文件的 MIME 类型错误,因此,它看起来像一个没有颜色的旧网站。

没有人知道我该如何解决这个问题?

谢谢!!

编辑:

我现在正在在线尝试它,并且发生了同样的情况。我什么都不改变。

如果我尝试这个 URL

http://alexander.comyr.com/gallery&name=Historias_del_mar

一切顺利,否则,试试这个:

http://alexander.comyr.com/gallery/Historias_del_mar

它不能正常工作

最佳答案

听起来您需要使您的 CSS 链接成为绝对链接,以便它们以 /web/ 开头,或者将相对 URI 基添加到页面的标题中:

<base href="/web/" />

或者如果您的 URI 基础只是 /(因为它出现在您的 htaccess 文件中),那么:

<base href="/" />

关于php - .htaccess 重定向,MIME 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22465935/

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