首页 文章

htaccess重写url,参数不显示图像

提问于
浏览
1

我正在尝试使用htaccess重写网址 .

我想要类似的网址,www.mydomain.com / region / category / product /

它将转到页面www.mydomain.com/index.php?reg=region&cat=category&prod=product

我在htaccess中使用以下代码,

RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?reg=$1&cat=$2&prod=$3 [L]

虽然我能够访问index.php中的参数,但是浏览器无法加载图像,css等,htaccess也会为它们重写URL .

请帮我解决这个问题 .

提前致谢!

2 回答

  • 2

    您可以在RewriteRule语句之前使用RewriteCond

    RewriteCond %{REQUEST_URI} !\.(jpg|png|css)$ [NC]
    
  • 0

    最后我能用它来运行它,

    <base href="/" />
    

相关问题