Unable to load images and stylesheet after URL rewrite

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Unable to load images and stylesheet after URL rewrite

Post by Rovas »

I followed several tutorials for rewriting URL for dinamic to static (i.e products?id=2 to products/2/name_of_product) but I have a problem when I type the modified URL the browser loads the page without images and the CSS style assigned to the HTML elements in the page.
The code is classic for the mod_rewrite ():
the rewrite rules

Code: Select all

//for taking the id value of a product from the new URL format
                               $sir=$_SERVER['PATH_INFO'];
				$sirFinal=explode("/", $sir);
                                $_GET["p"]=$sirFinal[1];
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The paths in your resulting HTML probably don't exist. They likely point to the current directory or a child of it. They probably need to point to the root.
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Post by Rovas »

Yes they all are relative paths solved it by putting

Code: Select all

<base path="domain">
Post Reply