Based on your question, it seems that your .htaccess file is in the /finance/ folder. If this is the case, the problem lies in the fact that your second RewriteRule
will match the requests for your scripts and sylesheets.
The conditions you have already will allow you to avoid this problem, but they only apply to the first rule that comes after them (your search rule). As usual, there are a few different ways to fix things, but the simplest is to copy your RewriteCond
block so that it applies to the second rule too. This would look like the following:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 =cms
RewriteRule ^([^/]*)/search/([^/]+)$ index.php?lang=$1&id=search&searchword=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !=cms
RewriteRule ^([^/]*)/([^/]*)$ index.php?lang=$1&id=$2 [L]
Note that you might not even need the condition block for the first rule, as it's probably unlikely that any of your real files match that test pattern. It is definitely needed on the second one though, to prevent your resources from being misdirected.
Alternative Approach
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond $1 !=cms
RewriteRule ^([^/]*) - [S=2]
RewriteRule ^([^/]*)/search/([^/]+)$ index.php?lang=$1&id=search&searchword=$2 [L]
RewriteRule ^([^/]*)/([^/]*)$ index.php?lang=$1&id=$2 [L]
In this approach, if any of your conditions match, we skip the next two rules (indicated by the S=2
. This is the same as applying the condition block to both of them. As Gumbo mentions, you could also use the L
flag in place of the S=2
to ignore every rule that comes after that block in the case of your conditions matching. Which of these options is most appropriate depends on what other rules you might want to add in the future.