Forum Moderators: phranque
I've used mod_rewrite before, but not in the way I am now attempting. I find the syntax difficult & I admit I don't fully understand.
I'm working on a new site, it's quite simple & database driven. My ideal solution is to have 1 page (index.php) which displays the required info from the db (home/about/contact/etc)
I would like to use mod_rewrite to convert the url:
>> example.com/index.php?lang=en&page=home
into:
>> example.com/en/home
So far I have it working, but my image & css links are not working & I am confused by the inconsistency of this.
EG: here is the .htaccess
RewriteEngine on
RewriteRule ^(.*)/(.*)$ index.php?lang=$1&page=$2
In this page I have several hard-coded links to CSS & images - however the results confuse me:
<link href="/website/basic.css" rel="stylesheet" type="text/css" /> [b]= THIS WORKS[/b]
<img src="/website/images/header_logo.jpg" /> [b]= THIS DOES NOT WORK[/b] (missing image)
Ideally, I would like the rewrite to expect ( /en/home/ ) & only rewrite those url's
(2 letter code) + (/) + (1-10 letter word) but that's beyond me at the moment.
Any advice on what could be the problem would be greatly appreciated!
Thanks,
Riquez
Jim