J.Doe J.Doe - 1 year ago 93
Apache Configuration Question

.htaccess requires extra '../' on src files

I am trying to turn




For that purpose i wrote this htaccess code

RewriteRule ^Topics/([0-9a-zA-Z]+) Topics.php?t=$1 [NC,L]

And now when url is
it requires extra '../' on src files like css or javascript.

Answer Source

Requirement to add an extra ../ is due to the fact that you're using relative paths in your css/js/images.

The new pretty URL in use is this:


If you're including css as href=style.css then it will try to find it as /Topics/style.css.

When using ../ it will correctly find css as /Topics/../style.css that translates to /style.css.

Note that instead of ../ you can add a / before your relative path to make it as:


Alternatively You can add this just below <head> section of your page's HTML:

<base href="/" />

so that every relative URL is resolved from that base URL and not from the current page's URL.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download