Need a 301 redirect script for php to html

Reply

Join Date: Aug 2009
Posts: 17
Reputation: decay is an unknown quantity at this point 
Solved Threads: 0
decay decay is offline Offline
Newbie Poster

Need a 301 redirect script for php to html

 
0
  #1
Aug 4th, 2009
Hi I am running on hosts shared server - windows 2003 with IIS 6 and apache but they can't redirect in IIS as its shared and I have no .htaccess rights even if I did my hosts say it is very limited. I also have front page server extensions installed. They said I have to use scripts to do the 301 redirect my pages are HTML but meta refresh and javascripts are a big no go areas with SEO.

I need a 301 redirect script for SEO so that I can redirect non-www version to www.mysite.com

All my files are html with .htm extension and I am a complete newb to PHP but googled some PHP scripts and tested but none worked. I even duplicated index.htm to index.php and coded in there but couldn't get that to work either.

I posted similar in web developing HTML section of this forum but no luck there so far.

PLEASE HELP! I am now loosing much sleep over this problem. Thank you in advance.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: Need a 301 redirect script for php to html

 
0
  #2
Aug 5th, 2009
  1. <?
  2. header( "HTTP/1.1 301 Moved Permanently" );
  3. header( "Location: http://www.your-new-site.com/your-new-url.html" );
  4. ?>
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 17
Reputation: decay is an unknown quantity at this point 
Solved Threads: 0
decay decay is offline Offline
Newbie Poster

Re: Need a 301 redirect script for php to html

 
0
  #3
Aug 5th, 2009
Thankyou for the code and syntax but now I do not know what to do with it. Do I simply paste the code at the top of my index.htm file above the headers or do I need to make a new duplicate index.htm and name it index.php and only have the code in this file? If so how does the server pick up the php file and not the htm file?

My new site is the same as my old site only it has www. in front of it. Infact it is the same site all together but just the reference on the server.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Need a 301 redirect script for php to html

 
0
  #4
Aug 5th, 2009
Well, if the page is .htm and the server is not set up to parse php in .htm files, just use a meta refresh:
  1. <html>
  2. <head>
  3. <meta http-equiv="refresh" content="2;url=http://www.yoursite.com/newpage.htm" />
  4. <title>Page has moved</title>
  5. </head>
Lost time is never found again.
- Benjamin Franklin
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 17
Reputation: decay is an unknown quantity at this point 
Solved Threads: 0
decay decay is offline Offline
Newbie Poster

Re: Need a 301 redirect script for php to html

 
0
  #5
Aug 6th, 2009
Hi thank you for the reply however I can not use a meta refresh as the status code 301 will not get returned and I will get peanalised SEO wise. Also my page ranking will not get carried over. People say NEVER use a meta refresh. Javascript in html is also highly recommended against.

I am not sure what the server can or can not do I was meerly asking my host about .htaccess and he said it has very basic functionality on their setup and mentioned it can not do something with PHP however seen as I do not know PHP i did not understand what he said. I am guessing he meant what you said.

I know that when I went into my very basic control panel I found I have option 2 and I am paying an extra £10 pa for this option but get FPSE and this also gives me scripting options using PHP, ASP and ASP.net

I do not know either but am quite sure there must be a PHP script I can use but I do not know how to use it even if I have the code.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC