【问题标题】:css not displaying with absolute paths after .htaccess re_writes在 .htaccess re_writes 之后,css 不显示绝对路径
【发布时间】:2013-11-07 03:33:21
【问题描述】:

我在.htaccess中使用mod_rewrite后遇到CSS不显示的问题,问题出在:

Options +FollowSymLinks  
RewriteEngine On  
RewriteRule ^css/(.*)$ Templates/Testing/html/css/$1 [QSA]
RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  

RewriteRule ^.*$ ./index.php  

CSS 位于:

模板/{TemplateName}/html/css/

在这种情况下,TemplateName 正在测试中。但在我的视图源中,它只是我在

中所拥有的任何内容的无限循环
 <link href="" rel="stylesheet" type="text/css" />

我尝试创建虚拟目录以将虚拟目录重新映射到物理目录,但这没有运气!

【问题讨论】:

    标签: html apache .htaccess mod-rewrite


    【解决方案1】:

    尝试在两个规则中添加L 标志:

    Options +FollowSymLinks  
    
    RewriteEngine On  
    RewriteRule ^(css/.+)$ Templates/Testing/html/$1 [NC,L]
    
    RewriteCond %{SCRIPT_FILENAME} !-d  
    RewriteCond %{SCRIPT_FILENAME} !-f  
    RewriteRule ^ index.php [L]
    

    【讨论】:

    • 像魅力一样工作,问题是.. 在我的 URL /work/work/stopsworking 中有超过 2 个参数后,CSS 不显示?
    猜你喜欢
    • 1970-01-01
    • 2017-04-20
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 2014-06-23
    • 2012-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多