Auto Redirect From The Old URL to The New URL of My Website

I was migrating my articles from my old website which not using WordPress to the new one that using WordPress. Just for your information, the domain of that my website was not changed. Only the URL of all my articles on the old website that become being changed on my new website, and with the new structure, indeed. Then I found the technique how to redirect from the old URL to the new URL by optimizing the .htaccess file. The following code will show you how you can do this if you encounter the same problem some other time.

Simply add this following code to your .htaccess file that located in your web root directory (adjust the URL with yours):

redirect 301 /old/old-permalink/ http://www.yourdomain/new-permalink

Be sure not to add “http://www.yourdomain” to the first part of the statement – just put the path from the top level of your site to the page. Also ensure that you leave a single space between these elements:

redirect 301 (the instruction that the page has moved)

/old/old-permalink/ (the original folder path and file name)

http://www.yourdomain/new-permalink/ (new path and file name)

Hopefully this will be helpful for you.

Share

1,512 viewsPrint This Post Print This Post

Comments

  1. jaya says:

    klo di buat otomatis bisa ga mas? cz aku baru rubah permalink. tp permalink yang lama begitu di buka page notfind… mohon pencerahanya mas. makasih

  2. @jaya

    Bisa saja, tapi tetap harus didaftarin dulu URL yang lama agar di-mapping-kan ke URL yang baru. Solusinya di artikel berikut: http://www.openscriptsolution.com/2009/10/05/another-solution-to-redirect-from-old-url-to-new-url-using-simple-301-redirects-plugin/

  3. gus arik says:

    ini dibuatnya di .httaccess di domain yang lama kan mas? bukan di .httaccess domain yg baru?

Trackbacks

  1. [...] tested this plugin and it worked like a charm. Before I found this plugin, I had tried to use the redirect 301 by using .htaccess file, but unfortunately, it did not [...]

Speak Your Mind

*


*