user3706610
user3706610

Reputation: 19

why I use mod_rewrite in .htaccess my css files can not use?

I have this url:

http://domain.com/index.php?type=item&id=656&title=mytitle

Kow I want rewrite this url in .htaccess to:

http://domain.com/item/656/mytitle

I used this ruls in .htaccess:

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?type=$1&id=$2&title=$3 [L]

It has worked but my css and js files in index.php not working

My css file link

<link rel="stylesheet" type="text/css" href="file/css/style.css" />

Upvotes: 0

Views: 33

Answers (1)

Wojciech Mleczek
Wojciech Mleczek

Reputation: 1634

Read about RewriteCond

# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
# Then...
RewriteRule ...

or

# If the uri not starts with ...
RewriteCond %{REQUEST_URI} !^/file/css
# Then...
RewriteRule ...

Upvotes: 1

Related Questions