Jump to content

redirect to different pages


php_begins

Recommended Posts

I have pagination code in members page that has pages 1,2,3 and so on.

/member_test.php?pn=1 where pn can be 1,2,3 etc.

 

I need to redirect the above page such that it redirects to /test/1 , test/2 and so on..

I have the following rule which works perfectly fine in the browser.

 

RewriteRule ^/member_test.php?pn=(.*) /test/$1 [PT]

 

But the content of the above redirect is always page 1. i.e it always dispays the content of member_test.php?pn=1..

/test/1 ,test/2, test/3 always displays the  content of 1.

 

Can you help me with the current redirect rule..

Link to comment
https://forums.phpfreaks.com/topic/251564-redirect-to-different-pages/
Share on other sites

I have the following rule which works perfectly fine in the browser.

 

RewriteRule ^/member_test.php?pn=(.*) /test/$1 [PT]

 

But the content of the above redirect is always page 1. i.e it always dispays the content of member_test.php?pn=1..

So it's not perfectly fine...

 

First, are you talking about redirecting from member_test.php to /test? Because I think you aren't. I think you mean

I want people to go to /test/N and pretend as if they actually went to /member_test.php?pn=N

In that case you have your RewriteRule terms backwards:

RewriteRule old_url new_url

i didnt explain it properly.

When people click on member_test.php?pn=2  (the link would point to /test/2 in my php code)

it would take them to member_test.php?pn=2, but in the URL it would show /test/2.

So for them it would look like they are in test/2, but in reality it would show the page produced by member_test.php?pn=2

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.