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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.