简体   繁体   中英

missing css when url rewrite using .htaccess

  1. this is the first time to me to rewrite url using .htaccess.
  2. when I rewrite the url my css was missing
  3. here is my code:

     RewriteEngine On RewriteBase /blog/ RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteRule ^([0-9]+)/([^/.]+)/?$ catview.php?ctid=$1&cet_slug=$2 [QSA,L] 

I need the url: blog/9/iphone

It's working but missing css! Can anyone help me?

You can use following code of .htaccess by which you can acheive your requirement:

not rewrite css, js and images

RewriteCond %{REQUEST_URI} !\.(?:css|js|jpe?g|gif|png)$ [NC]
RewriteRule ^xyz/(.+)/(.+)/ abc.php?id=$1&name=$2 [L]

rewrite css, js and images, from root

RewriteRule ^xyz/[^/]+/[^/]+/(.+)$ $1  [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM