Forum Moderators: phranque

Message Too Old, No Replies

Rewite full url in another url

Controlling frames content

         

abbeyvet

1:36 am on Jan 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This may not be a runner, but there is no harm in asking :)

I am controlling the content of an iframe by using a query string in links that point to the page containing the frameset. So, basically the iframe is like this:

<iframe src="<?php echo $content;?>" name="content"></iframe>

The framed content is at another site - I am framing with permission - so the page linked to is sometimes like this - no variables, just a straight url:

/page.php?content="http://subweb.site.com/dir/"

Sometimes it's longer and ends with a string that varies (the rest is consistent). I am using a CMS with a field where if just the string part is entered, the full url is generated.:

/page.php?content="http://subweb.site.com/dir/dir2/string"

I know that the URLs I am using are being rewritten already at the other site - but is there any way that I can make the URLs on my site a little prettier?

jdMorgan

3:48 am on Jan 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, it's possible to pretty those URLs up, with two provisos:

First you can only rewrite URLs that point to your own domain. This case qualifies, since the script is on your server. Mod_rewrite is activated during the URL-to-filename translation phase of request URL processing, so the request must "land" on your server if mod_rewrite is to be expected to act on it.

Second, and requiring more consideration, your "pretty" URLs must contain all the information needed to reconstruct all the possible valid and unique "ugly" URLs; Mod_rewrite cannot create information, but it can add fixed characters and words, and re-arrange and do pre-defined substitutions on the ones you provide in the pretty URL. If you have server configuration access, you can also use RewriteMaps to do far more complex manipulations, and even database lookups, to translate the pretty URLs to the ones needed to call your script to access the remote site.

So, often it comes down to a question of the variability of the fields in the URL -- How tightly they are scoped, in other words.

Think about the format that you want to use for the pretty URLs with the above points in mind.

Jim