Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Help: folder1/folder2/index.php to folder1/index.html

         

sjariri

9:59 am on Dec 12, 2005 (gmt 0)

10+ Year Member



I reviewed many related threads here, but couldn't get my htaccess work for this rewrite:

[test.com...]
to
[test.com...]

Would appreciate any help,

jdMorgan

10:14 pm on Dec 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi sjariri,

Please post your attempt at coding this, so we can discuss it. It can save a lot of time, and help you get a better answer.

Or, for more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

sjariri

10:57 am on Dec 13, 2005 (gmt 0)

10+ Year Member



Thanks jdMorgan. Here is what I have: (in the .htaccess of the folder1 directory)

RewriteRule ^index\.html$ [test.com...]

It works quite fine. But the problem is that all links and images in index.php are relative to that directory, so when I successfully see [test.com...] it is not loading images and links properly. Any idea on how to overcome this issue?

Thanks,

jdMorgan

2:47 pm on Dec 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, remember that relative URLs are resolved by the client (e.g. the browser). So the browser will interpret the relative URLs it finds on your pages, in relation to whatever 'directory-level' it thinks the current page URL represents. The browser has no knowledge of your server-internal rewrites.

So, you will need to either rewrite all of the included page elements' URL-paths, use server-relative URLs, or use absolute URLs -- i.e., use <img src="/path-to-image-from-web-root"> or <img src="http://www.example.com/path-to-image">.

Jim