Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Redirecting multiple dynamic (php) pages?

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  Redirect question  
Author Message
user2680

External


Since: Feb 19, 2004
Posts: 1



(Msg. 1) Posted: Thu Feb 19, 2004 5:32 am
Post subject: Redirecting multiple dynamic (php) pages?
Archived from groups: alt>apache>configuration (more info?)

Please bare with me if this has already been asked before but I have
been trying to figure out how to use .htaccess to redirect dynamic
PHP-pages?

The situation is this. I am running a site on a virtual server running
Apache. I have access to modify .htaccess for whatever directory I
want but I can't make changes to the Apache configuration (as far as I
know).

At the site we have been running an old forum software that by now is
heavily indexed in Google. Recently we upgraded to a new forum
software and I want to redirect the users who through search engines
find indexed topics in the old forum to the new one.

The URL:s in the old forum looks like this:

http://www.allamedia.com/forum/viewtopic.php?TopicID=3895

.... and in the new forum like this:

http://www.allamedia.com/ipb/index.php?showtopic=3895

How can I redirect people who try to access the first URL (and any URL
like it) to the second URL?

Any help is much appreciated!

 >> Stay informed about: Redirecting multiple dynamic (php) pages? 
Back to top
Login to vote
meel_me_niet

External


Since: Aug 06, 2003
Posts: 9



(Msg. 2) Posted: Sun Feb 22, 2004 12:10 am
Post subject: Re: Redirecting multiple dynamic (php) pages? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Why don't you just solve this in PHP?

/forum/viewtopic.php

<?php
list ($oldname,$ID) = explode ("=",$QUERY_STRING);
header ("Location : <a style='text-decoration: underline;' href="http://............./ipb/index.php?showtopic=" target="_blank">http://............./ipb/index.php?showtopic=</a>".$ID);
?>

cheers

Niels


"Manolo Hernandez" <mh.RemoveThis@empty.newcamp.net> wrote in message
news:34b023ca.0402190232.1b027887@posting.google.com...
 > Please bare with me if this has already been asked before but I have
 > been trying to figure out how to use .htaccess to redirect dynamic
 > PHP-pages?
 >
 > The situation is this. I am running a site on a virtual server running
 > Apache. I have access to modify .htaccess for whatever directory I
 > want but I can't make changes to the Apache configuration (as far as I
 > know).
 >
 > At the site we have been running an old forum software that by now is
 > heavily indexed in Google. Recently we upgraded to a new forum
 > software and I want to redirect the users who through search engines
 > find indexed topics in the old forum to the new one.
 >
 > The URL:s in the old forum looks like this:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.allamedia.com/forum/viewtopic.php?TopicID=3895</font" target="_blank">http://www.allamedia.com/forum/viewtopic.php?TopicID=3895</font</a>>
 >
 > ... and in the new forum like this:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.allamedia.com/ipb/index.php?showtopic=3895</font" target="_blank">http://www.allamedia.com/ipb/index.php?showtopic=3895</font</a>>
 >
 > How can I redirect people who try to access the first URL (and any URL
 > like it) to the second URL?
 >
 > Any help is much appreciated!<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Redirecting multiple dynamic (php) pages? 
Back to top
Login to vote
jring

External


Since: Jun 30, 2003
Posts: 154



(Msg. 3) Posted: Sun Feb 22, 2004 6:52 pm
Post subject: Re: Redirecting multiple dynamic (php) pages? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 > The URL:s in the old forum looks like this:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.allamedia.com/forum/viewtopic.php?TopicID=3895</font" target="_blank">http://www.allamedia.com/forum/viewtopic.php?TopicID=3895</font</a>>
 >
 > ... and in the new forum like this:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.allamedia.com/ipb/index.php?showtopic=3895</font" target="_blank">http://www.allamedia.com/ipb/index.php?showtopic=3895</font</a>>
 >
 > How can I redirect people who try to access the first URL (and any URL
 > like it) to the second URL?

RewriteEngine on

RewriteCond %{QUERY_STRING} ^TopicID=[0-9]+$
RewriteRule /forum/viewtopic.php /ipb/index.php?showtopic=%1 [R,L]

mod_rewrite has to be loaded for this to work.

joachim<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Redirecting multiple dynamic (php) pages? 
Back to top
Login to vote
jring

External


Since: Jun 30, 2003
Posts: 154



(Msg. 4) Posted: Sun Feb 22, 2004 6:53 pm
Post subject: Re: Redirecting multiple dynamic (php) pages? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 > The URL:s in the old forum looks like this:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.allamedia.com/forum/viewtopic.php?TopicID=3895</font" target="_blank">http://www.allamedia.com/forum/viewtopic.php?TopicID=3895</font</a>>
 >
 > ... and in the new forum like this:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.allamedia.com/ipb/index.php?showtopic=3895</font" target="_blank">http://www.allamedia.com/ipb/index.php?showtopic=3895</font</a>>
 >
 > How can I redirect people who try to access the first URL (and any URL
 > like it) to the second URL?

oops, forgot the braces around the caption...

RewriteEngine on

RewriteCond %{QUERY_STRING} ^TopicID=([0-9]+)$
RewriteRule /forum/viewtopic.php /ipb/index.php?showtopic=%1 [R,L]

mod_rewrite has to be loaded for this to work.

joachim<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Redirecting multiple dynamic (php) pages? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
dynamic pages? - Hi, Any idea how I can deliver this page: <html><body>Hello from foo</body></html> to anyone visiting /foo such that it appears to the browser to actually come from /foo and <html><body>Hello from bar</body>...

Multiple sets of dynamic virtual hosts - Hi. I have a bunch of virtual hosts like this: site1.john.company.com site2.john.company.com site3.john.company.com site1.paul.company.com site2.paul.company.com site3.paul.company.com I would like to use dynamic virtual hosting so I can jus...

Im sick of java and tomcat, what is good apache combo for .. - damn im so sick fo java and tomcat

redirecting if missing file or page - At present my apache2 server gives a 404 message if someone tries to access a non-existent page or file. On some forums I have posted some links to photos in the past. If I want to restructure my server so that those links are no longer correct, is ther...

Multiple SSL sites, Multiple IP Addresses - I've been running an Apache 2.0 server for a while with multiple name- based virtual sites on port 80 and one SSL site on the same IP address. I need to add a second SSL site and I'm having trouble with the configuration. I have an available IP Address...
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]