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.

Recommended Answers

All 4 Replies

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.

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>
<head>
<meta http-equiv="refresh" content="2;url=http://www.yoursite.com/newpage.htm" />
<title>Page has moved</title>
</head>

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.