I’m trying to make my website URLs SEO-friendly, and I’m having problems…
How can I change this URL:
http://www.example.com/media.php?album=Album_1&page=1
To this kind of URL:
http://www.example.com/media/Album_1/1
I’ve tried this code that works, but my CSS seems KO…
RewriteEngine On
RewriteRule ^media/(.*?)/([0-9]+)$ media.php?album=$1&page=$2
Your rule’s target doesn’t need the
&, it should just be&. Apache will propery encode it as needed (like in the anchor link in the HTML returned in a redirect). The reason your css isn’t working sounds like a relative vs absolute URL issue. If your css is linked like<link rel=stylesheet href="something.css">, the relative URL resolution ends up being/media/Album_1/something.css.Try adding this in the headers of your pages: