Confused by rewritebase

Using mod_rewrite to handle various content issues

Confused by rewritebase

Postby andybak » Tue Jan 28, 2003 8:54 am

I am trying to get a dynamic page to appear static.

Requests to the page take two forms. either:

institution.html
which gets mapped to:
displaylist.php?InstitutionID=institution

and...

institution/section.html
which gets mapped to:
displaylist.php?InstitutionID=institution&SectionID=section


This is working so far:
Code: Select all
RewriteEngine on
rewritebase /nmdc/newspol/lists_non/
rewriterule ^(.*)/(.*)\.html$ /nmdc/newspol/lists_non/displaylist.php?InstitutionID=$1&SectionID=$2 [l]
rewriterule ^(.*)\.html$ /nmdc/newspol/lists_non/displaylist.php?InstitutionID=$1 [l]


Except that when the first rule is matched any internal inliks in the page are broken (images/css etc.)

Can anyone help me here?
andybak
 
Posts: 1
Joined: Tue Jan 28, 2003 8:49 am

HTML Solution?

Postby theging » Sun Apr 06, 2003 1:26 am

There are something things that you haven't been clear about in your post. Such as which domain the rewriting is occuring in. However I remember of running into a similar problem on my site. What seems to be happening is that your pages are being rewritten but your images and CSS aren't. (This is a problem when rewriting out of a directory when your links are reletive). It would be a pain to rewrite all your images and CSS. Therefore the best thing to do is to use a base href within your <HEAD> tags. ie.

<base href="http://www.domain.ext/>

You'll need to play with the url obviously. But this should fix your problem. Make sure you place the code above the code to include your .css file as otherwise you won't get the CSS.

Good Luck!
theging
 
Posts: 2
Joined: Sun Apr 06, 2003 12:53 am


Return to Content

Who is online

Users browsing this forum: No registered users and 12 guests

cron