I need to create a 301 redirect from file-1.html to file-2.html. It will be on windows hosting server. I have tried .htaccess and several other methods ,but none of them seem to be effective. What script should I use and where do I place the script?
.htaccess file will only work if the HTTP server is Apache (and if it is configured to allow local overrides and if it has the
mod_rewrite module loaded and enabled).
So if the server isn’t running Apache you’ll have to find how to do this with IIS or whatever is used instead. If it does run Apache but is not configured to allow this, you’re out of luck.
You may want install this redirect on the server side?
You could put a code in file-1.html.
Exactly what code, depends on the languages available on the server: http://www.webconfs.com/how-to-redirect-a-webpage.php
Take it easy. Contact web host and ask them to do that for you. Do not hesitate, that is the part of the web hosting service they provide for you
I contacted them, but they have horrible customer service and made the website go down for over 24 hours while trying to create a 301.
Permanent redirection 301 with .htaccess file requires that your website is hosted on an Apache (Linux, UNIX) based server. If you are not sure, a simple header check will show your server type. Header checker allows you to check the HTTP headers that the web server returns when requesting a URL.
-.htaccess does not work if you’re on a windows server
-Always be sure to upload .htaccess files in ascii mode, sending it up as binary will break it
-Make sure your ftp program will show .htaccess files
-Double check that you’re not overwriting an old one
Let me know if I can help more’’
If their customer service is horrible why don’t you find a better provider?
Basically, correct answers however:
IIS does support .htaccess and a M$ version of mod_rewrite which is close enough to make the redirect.
It’s TRIVIAL to include a meta refresh statement in plain vanilla html files (in the <HEAD> section):
<meta http-equiv="refresh" content="file-2.html" />
That however might have SEO related consequences (assuming file-1 was popular and getting lots of links to it). At least, that’s why I think so many are keen to do 301 redirects. From a visitor’s perspective, there’s little real difference.