{"id":2271,"date":"2012-04-22T06:04:40","date_gmt":"2012-04-22T06:04:40","guid":{"rendered":"http:\/\/2slick.com\/web\/?p=2271"},"modified":"2012-04-24T07:55:16","modified_gmt":"2012-04-24T07:55:16","slug":"php-header-301","status":"publish","type":"post","link":"https:\/\/2slick.com\/web\/php-header-301\/affordablewebsitestips\/tutorials","title":{"rendered":"PHP Header 301"},"content":{"rendered":"<h3>How to create a 301 redirect using PHP<\/h3>\n<p>Create this PHP file, named index.php, with these lines of code at the top, and place it on the server.<\/p>\n<p><!--DEVFMTCODE--><pre class=\"devcodeblock\" title=\"Javascript\"><table class=\"devcodetools\"><tbody><tr><td>&nbsp;Javascript&nbsp;|&nbsp;<\/td><td style=\"background-image:url('https:\/\/2slick.com\/web\/wp-content\/plugins\/devformatter\/img\/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;\"\/><embed id=\"ZeroClipboard1\" src=\"https:\/\/2slick.com\/web\/wp-content\/plugins\/devformatter\/_zclipboard.swf\" loop=\"false\" menu=\"false\" quality=\"best\" bgcolor=\"#ffffff\" width=\"16px\" height=\"16px\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" flashvars=\"id=1&width=16&height=16\" wmode=\"transparent\" \/><\/td><td>&nbsp;copy&nbsp;code&nbsp;|<\/td><td style=\"cursor:pointer\" title=\"DevFormatter Plugin\" onclick=\"devfmt_credits()\">?<\/td><td width=\"99%\">&nbsp;<\/td><\/tr><\/tbody><\/table><div class=\"devcodeoverflow\"><table class=\"devcodearea\" width=\"100%\"><tr><td class=\"devcodelines\" width=\"1%\">1<\/td><td class=\"devcodelinesarea\"><pre class=\"devcode devcodeline\"><span style=\"color: #339933;\">&lt;?<\/span><\/pre><\/td><\/tr><tr><td class=\"devcodelines devcodelinesodd devcodelinesodd\" width=\"1%\">2<\/td><td class=\"devcodelinesarea devcodelinesareaodd devcodelinesareaodd\"><pre class=\"devcode devcodeline\">Header<span style=\"color: #009900;\">&#40;<\/span> <span style=\"color: #3366CC;\">&quot;HTTP\/1.1 301 Moved Permanently&quot;<\/span> <span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <\/pre><\/td><\/tr><tr><td class=\"devcodelines\" width=\"1%\">3<\/td><td class=\"devcodelinesarea\"><pre class=\"devcode devcodeline\">Header<span style=\"color: #009900;\">&#40;<\/span> <span style=\"color: #3366CC;\">&quot;Location: http:\/\/www.new-url.com&quot;<\/span> <span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <\/pre><\/td><\/tr><tr><td class=\"devcodelines devcodelinesodd devcodelinesodd\" width=\"1%\">4<\/td><td class=\"devcodelinesarea devcodelinesareaodd devcodelinesareaodd\"><pre class=\"devcode devcodeline\"><span style=\"color: #339933;\">?&gt;<\/span><\/pre><\/td><\/tr><\/table><\/div><\/pre><!--END_DEVFMTCODE--><\/p>\n<h3>Create a PHP header 301 redirect using just your cPanel<\/p>\n<h3>\n<iframe loading=\"lazy\" width=\"480\" height=\"360\" src=\"http:\/\/www.youtube.com\/embed\/N2MZ5K_ait4\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to create a 301 redirect using PHP Create this PHP file, named index.php, with these lines of code at the top, and place it on the server. &nbsp;Javascript&nbsp;|&nbsp;&nbsp;copy&nbsp;code&nbsp;|?&nbsp;1&lt;?2Header&#40; &quot;HTTP\/1.1 301 Moved Permanently&quot; &#41;; 3Header&#40; &quot;Location: http:\/\/www.new-url.com&quot; &#41;; 4?&gt; Create a PHP header 301 redirect using just your cPanel<\/p>\n","protected":false},"author":1,"featured_media":2272,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,143,4],"tags":[320,209],"class_list":["post-2271","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-affordablewebsitestips","category-internet-tips","category-tutorials","tag-301-redirect","tag-cpanel"],"_links":{"self":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/2271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/comments?post=2271"}],"version-history":[{"count":3,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/2271\/revisions"}],"predecessor-version":[{"id":2405,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/posts\/2271\/revisions\/2405"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media\/2272"}],"wp:attachment":[{"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/media?parent=2271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/categories?post=2271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2slick.com\/web\/wp-json\/wp\/v2\/tags?post=2271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}