Forum Moderators: phranque

Message Too Old, No Replies

How to 301 Redirect Pages With GET Variables to Static Pages

Example: http://example.com/?pageid=10 to http://example.com/somepage.php

         

sr123

8:36 am on Jul 6, 2005 (gmt 0)

10+ Year Member



I have decided to make all static pages that load content from a database using GET variables in the URL to pages without get variables, and I want to determine the best method for doing this.

I have several areas on my site where I use GET variables to load content using?pageid=# (where # is some numeric reference in to a database record for the content of the page). I am convinced that Google is no longer ranking these pages well or returning pages like this from my site in their SERPS.

These pages URLs currently look like:

http://example.com/?pageid=10

and I'd like to redirect pages like this to something like:

http://example.com/somepage.php

The page somepage.php would load the appropriate content from the DB without needing the reference of pageid=10 in the get variable.

Which of the following methods is better (and how are these done?):

1) 301 redirect from apache using mod_rewrite
2) 301 redirect from within the php page

Any help would be greatly appreciated. I have read a number of threads from webmasterworld regarding 301 redirects but am unsure as to which approach would be easier to maintain from the above two choices, and what the best method is for implementing them (especially choice #1).

Thanks in advance,
sr123

[edited by: ciml at 6:16 pm (utc) on July 6, 2005]
[edit reason] Examplified [/edit]