?
Solved

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

Posted on 2010-11-11
4
Medium Priority
?
403 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secureā€¦
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

771 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