0
votes

I have a website which is using Yii2 web framework, what I am trying to do with apache is to rewrite url when the request is not ask for js or css file. here comes my config:

    #in httpd.conf
   <VirtualHost *:80> 
        DocumentRoot /Users/shenshijun/Sites/intuplus/frontend/web
        ServerName intuplus
        RewriteEngine On
        <IfModule rewrite_module>

            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^/(.*)$ /index.php/$1

            LogLevel alert rewrite:trace3
        </IfModule>
    </VirtualHost>

The url for js file is like the following:http://intuplus/assets/85c70b6b/js/bootstrap.js, which I can access when I remove rewrite rule. But when I add rewriterule and rewritecond, url is rewrite anyway and I can not access js file or css file. So, can somebody explain why RewriteCond is not working here?

oh, apache version:Server version: Apache/2.4.10 (Unix)

1

1 Answers

0
votes

Your rewrite rule is wrong, you should try this :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

Read more : http://www.yiiframework.com/doc-2.0/guide-start-installation.html#recommended-apache-configuration