Home >Backend Development >PHP Tutorial >.htaccess 文件重定向之后,小弟我的css和js都无法访问了。咋回事呢?求大家指导一下

.htaccess 文件重定向之后,小弟我的css和js都无法访问了。咋回事呢?求大家指导一下

WBOY
WBOYOriginal
2016-06-13 09:59:581048browse

.htaccess 文件重定向之后,我的css和js都无法访问了。怎么回事呢??求大家指导一下。

RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteRule (.*) index.php [L]


这样之后,把所有url都解析到我的index.php中,但是页面的css和js也被解析了,求解。

------解决方案--------------------
控制一下条件

PHP code
<ifmodule mod_rewrite.c>    RewriteEngine On    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteRule ^(.*)$ index.php [L]</ifmodule><br><font color="#e78608">------解决方案--------------------</font><br><ifmodule mod_rewrite.c><br>RewriteEngine on<br>RewriteRule    (captcha.php) images/captcha.php [L]<br>RewriteRule    (filter.js) scripts/filter.js [L]<br>RewriteRule    (jquery.js) scripts/jquery.js [L]<br>RewriteRule    (.css) styles/styles.css [L]<br>RewriteRule    (.*) index.php [L]<br></ifmodule><div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn