{"id":18,"date":"2007-03-16T10:53:00","date_gmt":"2007-03-16T14:53:00","guid":{"rendered":"http:\/\/webmaster.www.websitesinaflash.com\/?p=18"},"modified":"2022-08-09T12:22:42","modified_gmt":"2022-08-09T19:22:42","slug":"htaccess-301-redirect-moved-permanently","status":"publish","type":"post","link":"https:\/\/www.websitesinaflash.com\/2007\/03\/htaccess-301-redirect-moved-permanently\/","title":{"rendered":".htaccess 301 Redirect: Moved Permanently"},"content":{"rendered":"

I’ve already discussed how to create a 301 permanent redirect using PHP<\/a> that allows you to forward one page to another. But what if you you have an entire site to redirect? What if you’ve changed domain names? There has got to be a better way to redirect your site besides, adding a php 301 redirect to every page. Well there is! It’s called .htaccess.<\/p>\n

My next post will be a quick introduction to “.htaccess”.<\/p>\n

If you only want to redirect from one page on your site to another, this is the .htaccess code to use:<\/p>\n

redirect 301 \/oldfolder\/oldfile.htm https:\/\/www.websitesinaflash.com\/<\/p><\/blockquote>\n

There are three parts to this redirect (make sure you put 1 space in between each element):<\/p>\n

1) “redirect 301”: This declares that you are doing a redirect, and that the code is 301: Permanent Redirect.<\/p>\n

2) “\/oldfolder\/oldfile.htm”: This declares the page you want to redirect from.<\/p>\n

3) “https:\/\/www.websitesinaflash.com\/”: This is where you want the page to redirect them to.<\/p>\n

This is useful when you have renamed pages, and want to make sure google knows where your new pages are, and also any visitors that would be directed to that old page will automatically be directed to the new page.<\/p>\n

But what about directing an entire folder or site to another folder or site?
\nYou’ll have to wait for next post. =]<\/p>\n

Enjoy
\nAshton<\/p>\n","protected":false},"excerpt":{"rendered":"I’ve already discussed how to create a 301 permanent redirect using PHP that allows you to forward one page to another. But what if you you have an entire...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[21],"tags":[49,199,241,301],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/posts\/18"}],"collection":[{"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":0,"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.websitesinaflash.com\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}