Welcome to WebmasterWorld Guest from 54.159.214.250

Forum Moderators: Ocean10000 & incrediBILL & phranque

Redirect OLD URLs *.php?page=* to new URLs */page/*

Redirect OLD URLs *.php?page=* to new URLs */page/*

   
8:35 am on Oct 1, 2012 (gmt 0)

5+ Year Member



Hi,

My old website was in .php and currently, I am using WordPress script. I would like to redirect all my OLD URLs to new URLs.


My OLD site URL looks like this:
www.domainname.com/testimonials.php?page=1
www.domainname.com/testimonials.php?page=2
www.domainname.com/testimonials.php?page=3
www.domainname.com/testimonials.php?page=4 and so on

Another URLs OLD:
www.domainname.com/reviews.php?page=i-was-concerned-about-100-success-rate
www.domainname.com/review.php?page=i-am-impressed-with-your-quick-information
www.domainname.com/review.php?page=thank-you-for-all-you-have-done-for-us
... and so on

Now the structure has been changed with WordPress. Now the above URLs look like.
www.domainname.com/testimonials
www.domainname.com/testimonials/page/2
www.domainname.com/testimonials/page/3
www.domainname.com/testimonials/page/4
... and so on

Another URLs NEW:
www.domainname.com/i-was-concerned-about-100-success-rate
www.domainname.com/i-am-impressed-with-your-quick-information
www.domainname.com/thank-you-for-all-you-have-done-for-us
... and so on

My all old URLs are in Google and other search engines. I would like to redirect them (all my OLD URLs) to new URLs. E.g. testimonials.php?page=2 to testimonials/page/2 etc

Please help me to redirect them through .htaccess

My current .htaccess looks like as below:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Thanks in advance.
10:27 am on Oct 1, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



This question (or a close relation) is asked most weeks here.

If the new URL re-uses elements from the old URL you can do it with simple rules, so you'll be able to do that with many of the URLs.

Where the old URLs have no such re-usable features you should either:
- use a custom Wordpress redirect plugin or extension, or
- rewrite (that's internally rewrite, not redirect) all requests for old URLs to a simple PHP script that contains an array of old and new URLs, looks up the new URL and sends a 301 HEADER to the new URL, or sends a 404 HEADER if the old URL does not exist (i.e. for all unused ID numbers).
1:05 pm on Oct 1, 2012 (gmt 0)

5+ Year Member



Thanks so much for your reply. Its done by using the Redirection plugin
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month