I have a site with the following structure: domain.com -- a.php -- /data ---- b.php ---- c.css ---- /articles ------ d.txt a.php contains one line: include ('data/b.php'); a.php takes a querystring in the format ?article=d.txt and b.php gets the content of domain.com/data/articles/d.txt and displays it. b.php also contains this line: <link href="data/c.css" rel="stylesheet" type="text/css" /> what I'm trying to do is use mod_rewrite so that instead of using http://domain.com/a.php?article=d.txt a user would type http://domain.com/articles/d.php I've written a rule that works to a degree. It displays the article, but the problem is that the css file is not applied. What am I missing? RewriteEngine on RewriteRule ^articles/([^/.]+)\.php$ a.php?article=$1\.txt [L] thanks in advance for any help you can give me. I'm just learning about mod_rewrite and I'm sure it's something simple.
I've done a lot of mod_rewrite but with httpd.ini files which I don't think are compatible. My bit of advice would be to break it down and try it bit by bit on the tiniest morsel until you have it. Good luck. Eric
You have to change the CSS code in the HTML so it's as if the mod_rewrite URL was the actual URL. CSS and mod_rewrite hate each other!!!!
Thanks for your reply. I didn't really understand your reply, but is editing the HTML the only solution? I oversimplified the problem, and there are actually many files affected, not just one. I was hoping that I could get this to work by only modifying .htaccess Would it help to put another copy of the css file in another directory? If not, can you tell me what code needs to be changed?
All .htaccess does is makes fake URLs work. Changing the URLs drives CSS insane. Post the html of the code where you get the file and an example of the file URL, and the URL of the css file and I can try to get you the code. (I'm a CSS n00bie.)