views:

248

answers:

2

Hi,

I need some help with rewrite rules and nested URLs.

I am using TikiWiki for my website and am in the process of setting up SE friendly URLs for my projects. Specifically, I have the following rewrite rule for www.example.com/projects to point to a page that lists out all the projects hosted in example.

RewriteRule ^Projects$  articles?type=Project  [L]

This works fine.

Now, I would like to point www.example.com/projects/project1 to point to a specific project. I have this rewrite rule

RewriteRule ^(Projects/Project1)$     tiki-read_article.php?articleId=6

This works, but partially. The content is all rendered as text but the theme - images/ css etc all go for a toss - the page is completely in text.

I understand that this happens 'cause the relative paths in the theme/ css/ images all refer to Projects as the base folder instead of the root of the website.

I don't want to touch the CMS portion - change the theme/ css/ image paths in the files, more for reasons of upgradability.

Can someone help me understand and write a rule so that the above nested URL works?

Regards, Radha

A: 

You need to either change the CMS or write rewrite rules for your theme/CSS/image files. For example, if your images are in the /images/ directory within the site, try

RewriteRule ^Projects/(themes/.*)$ \1

or perhaps better

Alias /Projects/themes /themes

But still, I'd edit the CMS configuration if it were me.

David Zaslavsky
A: 

Relative URLs are resolved to absolute URLs on the base of the base URL that is the current document’s URL. So in your case the base URL is /projects/project1 and not /projects although your files are actually located there. Because the client uses only URLs and has no clue about the actual file system. And the current document’s URL is /projects/project1.

So use URL references with an absolute URL path (/projects/css/…) instead of relative ones.

Gumbo