Solved

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

Posted on 2010-11-11
4
401 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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 …

733 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