Forum Moderators: phranque

Message Too Old, No Replies

Remove subfolder from url?

         

statiiic

11:00 pm on Oct 29, 2007 (gmt 0)

10+ Year Member



Hi,

I'm trying to remove an subfolder name from my url. But with maintaining the links.

So I have www.domain.com
and an subfolder called test
So when I'm in the folder test I will see this in the url:
www.domain.com/test/
Now I want it to be www.domain.com. But in test/index.html there are pictures linked too. images/img.gif
So the proper link must be www.domain.com/test/images/img.gif
But when I remove test from the url with mod_rewrite he cant find the images anymore.
Does anyone has the proper mod_rewrite for this?

jdMorgan

1:19 pm on Oct 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We'll need to see the code you're using in order to understand this problem. Technically, mod_rewrite should be used to add "/test" to URLs requested from your server based on published links which do not contain "/test". Otherwise, there's a good possibility that you're going about this backwards.

Even if the links on your pages (which define the URLs) do not contain "/test", then there is still the problem: How do you decide whether to add "/test" to those URLs when they are requested from your server?

mod_rewrite takes action after a URL is requested from your server, and before the content-handler is invoked to server a file or invoke a script. Therefore, mod_rewrite can "change" an incoming URL, but it cannot change the URLs published on your pages. And as far as the www is concerned, the links published on your pages define the URLs.

Jim