?
Solved

Correct PHP code for hidden frame-based redirection (sent from htaccess)

Posted on 2010-11-11
4
Medium Priority
?
407 Views
Last Modified: 2012-06-21
Expanding on my original question, although the .htaccess redirect works, I'd like to redirect to a PHP document within the same domain and have it mask the redirection.

So, what I'd like to do is take:

RewriteRule ^t/([0-9]+)  http://otherdomain/tickets/$1  [R=301,NC]
RewriteRule ^e/([0-9]+)  http://otherdomain/entries/$1  [R=301,NC]

change them to

RewriteRule ^t/([0-9]+)  http://mydomain/rd.php?type=t&num=$1  [R=301,NC]
RewriteRule ^e/([0-9]+)  http://mydomain/rd.php?type=e&num=$1   [R=301,NC]

What I need is a working "rd.php" to handle a redirected request of this nature and then generate a frame-based redirect page sending the user to http://otherdomain/{type}/{num}

I have a version partially hacked together, but it's probably better than I refrain from posting and let someone whip one up in 30 seconds...

Thanks in advance!
Josh
0
Comment
Question by:joshky
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:virmaior
ID: 34120737
i'm not sure what you mean by frame-based redirect...

do you mean:
(a) the frame causes the web browser to navigate to the other page (thereby closing the current page)?
(b) the frame opens the new page and remains framed within the other?


if you want the frame to cause a 301 redirect, then this will only affect the frame itself and not the entire page including the browser bar.
0
 

Author Comment

by:joshky
ID: 34121327
Sorry about the confusion.  Basically, the HTML outside of the normal headers would be:

<frameset rows="100%,*" border="0">
  <frame src="http://otherdomain/tickets/$1" frameborder="0" />
  <frame frameborder="0" noresize />
</frameset>
0
 
LVL 20

Accepted Solution

by:
virmaior earned 2000 total points
ID: 34121988
<?php
echo '<frameset rows="100%,*" border="0">
  <frame src="http://otherdomain/tickets/'  . htmlentities($_GET['type']).  '/' . htmlentities($_GET['num']) . '" frameborder="0" />
  <frame frameborder="0" noresize />
</frameset>';

?>
0
 

Author Comment

by:joshky
ID: 34122311
Worked great... Thanks!
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question