CSS not loading after redirect with htaccess rewrite rule

前端 未结 12 2272
自闭症患者
自闭症患者 2020-12-03 05:18

I have the following Short-hand for a user profile url

RewriteRule ^(\\w+)/?$ ./profile.php?name_of_user=$1

The site is styled with the app

12条回答
  •  天命终不由人
    2020-12-03 06:11

    I've had what seems to be the same problem. I was trying to redirect from a site of the form: www.foo/category/details.

    I found the slash after "category" stopped both the CSS and images from being loaded.

    The cause is the default redirection passes the original URL to the browser. This can be seen from a JScript trace on window.location.pathname. The solution is simply to use a [R] flag in the rewrite rule.

提交回复
热议问题