php - htaccess Resource interpreted as Stylesheet but transferred with MIME type text/html -
im trying rewrite existing url http://localhost/website/article.php?id=5
http://localhost/website/article/5
hence htaccess code
rewritebase /website/ rewriteengine on rewritecond %{request_filename}\.php -f rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule article/([a-za-z0-9@.-])? article.php?id=$1 [l]
what resource interpreted stylesheet transferred mime type text/html: "http://localhost/website/article/css/bootstrap.min.css".
it appears article added file's url, redirecting file directories.
the real url should "http://localhost/website/css/bootstrap.min.css"
im quite new htaccess , trying create own copying existing ones
revision
my actual problem resources url being renamed well. i've eliminated lines of codes down 2 lines
rewriteengine on rewriterule article/([0-9@.-]) article.php?id=$1
but resources being redirected non existent http://localhost/website/article/js/main.js
instead of http://localhost/website/js/main.js
add rewrite condition exclude static files being rewritten:
rewritecond %{request_uri} !\.(?:css|js|jpe?g|gif|png)$ [nc]
Comments
Post a Comment