Reputation: 110
I've been making a web app with PHP but the problem is that when I try to rewrite:
to:
with HTACCESS, it loses all external files and only keeps the page's HTML. Please help me out?
My current Rewrite Rule:
RewriteRule users/([^/]+) user.php?username=$1 [NC,L]
Upvotes: 1
Views: 61
Reputation: 785246
Use any one of these solutions.
Solution 1: use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http://
or a slash /
.
Solution 2: Try adding this in your page's HTML header:
<base href="/" />
Solution 3: Add this rule in your .htaccess:
RewriteRule users/(.+?\.(?:jpe?g|gif|bmp|png|tiff|css|js))$ /$1 [NC,L,R=301]
Upvotes: 1