Apache Server configuration support - Redirecting multiple dynamic (php) pages?

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > February 2004 > Redirecting multiple dynamic (php) pages?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Redirecting multiple dynamic (php) pages?
Manolo Hernandez

2004-02-18, 9:33 pm

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/view...hp?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!
Niels Berkers

2004-02-21, 7:33 am

Why don't you just solve this in PHP?

/forum/viewtopic.php

<?php
list ($oldname,$ID) = explode ("=",$QUERY_STRING);
header ("Location : http://............./ipb/index.php?showtopic=".$ID);
?>

cheers

Niels


"Manolo Hernandez" <mh@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:
>
> http://www.allamedia.com/forum/view...hp?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!



Joachim Ring

2004-02-22, 10:33 am

> The URL:s in the old forum looks like this:
>
> http://www.allamedia.com/forum/view...hp?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?


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
Joachim Ring

2004-02-22, 10:33 am

> The URL:s in the old forum looks like this:
>
> http://www.allamedia.com/forum/view...hp?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?


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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com