Jump to content

Linked resources don't work with .htaccess virtual redirects. Need elegant sltn


Recommended Posts

So I have a website that that includes resources in the header, for example:

 

css/styles.css

js/someJavaScript.js

js/AnotherJavaScript.js

 

Everything works fine; let's say the url is example.com/store/something.php.

 

Using .htaccess, I'd like to redirect a virtual URL, say, example.com/ABCD to example.com/store/something.php. The redirection works fine (it's a virtual redirection; keeping example.com/ABCD in the address bar just like Wikipedia does, for example) but none of the resources display because it is ultimately looking for something relative to the virtual directory.

 

Is there a way to make the resources -- and I guess images and hrefs on the pages, if possible -- always link using the original path? Obviously I could hard-code all URLs, but I'm wondering if there is a simpler, more elegant solution.

 

Thanks!

This is a client issue, not a server issue. Please move this to the correct forum

 

I think I found the answer, the "base" tag: http://www.w3schools.com/tags/tag_base.asp

 

Because of that answer, marking as fixed. But this is in the wrong forum.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.