views:

910

answers:

2

Hi

I am new to .htaccess and mod_rewrite.

I am using the following Rewrite rules :

RewriteRule ^wants/([0-9]+)$ /wantlist.php?wantid=$1
RewriteRule ^dashboard$ /dashboard.php

I am able to successfully redirect both the cases.

But in order to do this, I had to change the css, js and other paths to absolute paths without which the css and js did not load.

I was using

<script type="javascript" src="js/javascript.js"></script>

which after the rewrite rule did not work and after i changed it to

<script type="javascript" src="http://mydomain.com/js/javascript.js"&gt;&lt;/script&gt;

i got it to work

The same is happening for any of the other URLs that are there in the website

Is there a way to bypass this as I am using relative paths almost everywhere in the site I am developing.

I know I am missing out on something.

Could someone please help me with this?

Thanks in advance,
Gnanesh

A: 

Take a closer look at RewriteBase directive. Maybe that would help.

Thevs
+1  A: 

This is an URL resolving issue. See http://stackoverflow.com/questions/891775/modrewrite-url-info-required/891785#891785

You could explicitly set a base URI with the BASE HTML element, for example:

<base href="/">
Gumbo