简体   繁体   English

使用.htaccess重写URL时缺少CSS

[英]missing css when url rewrite using .htaccess

  1. this is the first time to me to rewrite url using .htaccess. 这是我第一次使用.htaccess重写url。
  2. when I rewrite the url my css was missing 当我重写URL时,我的CSS丢失了
  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 我需要网址: blog/9/iphone

It's working but missing css! 它正在工作,但缺少CSS! Can anyone help me? 谁能帮我?

You can use following code of .htaccess by which you can acheive your requirement: 您可以使用以下.htaccess代码来满足您的要求:

not rewrite css, js and images 不重写CSS,JS和图像

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 从根目录重写CSS,JS和图像

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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