Ayan
Ayan

Reputation: 2918

CSS not loading after URL rewriting

I am trying to rewrite URL from example.com/test.php?id=hd3j3 to example.com/id/hd3j3.
The problem is rewriting occurs and I am taken to the page but the css and js of the page doesn't load. Where am I going wrong?

.htaccess

RewriteBase /
RewriteEngine On
RewriteRule ^id/([A-Za-z0-9]+)$ test.php?id=$1 [L]

Upvotes: 0

Views: 1776

Answers (2)

Try to clear the cache and retry ! This usually works.Or set the root path correctly. If these won't work try this, If you want to use image tag and show to correctly images, use " />

Upvotes: 0

Steffen Mächtel
Steffen Mächtel

Reputation: 1021

Your rewrite rule looks right for me.

Maybe your css gets loaded from a relative path and not absolute ?

<link href="css/layout.css">

The browser try to load from example.com/id/css/layout.css instead of example.com/css/layout.css

Upvotes: 1

Related Questions