| | |
Need a 301 redirect script for php to html
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Jul 2004
Posts: 234
Reputation:
Solved Threads: 8
php Syntax (Toggle Plain Text)
<? header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: http://www.your-new-site.com/your-new-url.html" ); ?>
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
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.
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.
Well, if the page is .htm and the server is not set up to parse php in .htm files, just use a meta refresh:
html Syntax (Toggle Plain Text)
<html> <head> <meta http-equiv="refresh" content="2;url=http://www.yoursite.com/newpage.htm" /> <title>Page has moved</title> </head>
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
•
•
Join Date: Aug 2009
Posts: 17
Reputation:
Solved Threads: 0
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.
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.
![]() |
Similar Threads
- Free PHP , JAVA SCRIPT , CSS , HTML and QTP tutorials ( study material ) (Website Reviews)
- Free PHP , JAVA SCRIPT , CSS , HTML and QTP tutorials ( study material ) (Website Reviews)
- Free PHP , JAVA SCRIPT , CSS , HTML and QTP tutorials ( study material ) (Website Reviews)
- Free PHP , JAVA SCRIPT , CSS , HTML and QTP tutorials ( study material ) (Website Reviews)
- Free PHP , JAVA SCRIPT , CSS , HTML and QTP tutorials ( study material ) (Website Reviews)
- Using simple php redirect script but need to pull information from mysql instead (PHP)
- xampp not running php as well as html files (PHP)
- Help with 301 redirect code - jsp in url (JSP)
Other Threads in the PHP Forum
- Previous Thread: how write div with in div elements in pdf using php
- Next Thread: IE6/IE7 unexpectedly drops the PHP Session ID cookie (PHPSESSID)
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





