Jump to content

Redirecting An Html Page


stkr
 Share

Recommended Posts

I used to have a splash page as my 'index.html' page and the first page of actual content was index2.html on my website. I have grown out of feeling the need to have a splash page, so I have removed the splash page and made what was the second page the first page of content for the website. The problem is that Google has established my 'index2.html' as my home page. If I remove the page then I will have a dead link indexed on Google. I've been trying to figure out how to get the 'index2.html' file to simply redirect to 'http://lostvalley-photography.com/' or essentially, the new index.html file. I've been trying to establish a 'html 301 redirect' with no success. I tried contacting GoDaddy, since they're who I host with, but they were no help. I'm using a Windows Server.:

Unfortunately we do not provide the means to perform html redirects with your hosting service, however you can create the needed custom html code and place this in the desired html files to cause a redirect. We will be unable to assist with the custom coding and scripting required to do this.
I am hoping that once again, I can get some assistance from the helpful posters here. Thanks in advance. Edited by stkr
Link to comment
Share on other sites

Does your host allow you to upload a .htaccess file?
I've been searching the help section, and I'm thinking that it is only supported on Linux-based hosting. My hosting, however, is Windows..
Link to comment
Share on other sites

I've been searching the help section, and I'm thinking that it is only supported on Linux-based hosting. My hosting, however, is Windows..
Windows or Linux doesn't matter. .htaccess works on Apache. I have Apache on Windows and .htaccess works just fine.
Link to comment
Share on other sites

How do I know if my server has Apache? And is it likely that using .htaccess will work by default? The file does not currently exist, so I would need to go ahead and create it and add the code.

Edited by stkr
Link to comment
Share on other sites

.htaccess is enabled by default on all Apache servers. GoDaddy's service description pages can tell you what server they are using, you can also use php_info() for this.

Link to comment
Share on other sites

i know of two ways (well 3, if htaccess is available):1 add below code in the page, between <head> and </head> and replace link to the destination you require<meta http-equiv="Refresh" content="0;url=http://localhost/misc/redirect/index.htm" />2 javascript, again between <head> and </head> and replace link to the destination you requirefunction redirecttoindex(){if (parent.location.href == self.location.href)window.location.href = "index.htm"}redirecttoindex()</script>

Edited by dsonesuk
Link to comment
Share on other sites

i know of two ways (well 3, if htaccess is available):1 add below code in the page, between <head> and </head> and replace link to the destination you require<meta http-equiv="Refresh" content="0;url=http://localhost/misc/redirect/index.htm" />2 javascript, again between <head> and </head> and replace link to the destination you requirefunction redirecttoindex(){if (parent.location.href == self.location.href)window.location.href = "index.htm"}redirecttoindex()</script>
If you want to send a 301 status message, those two methods are not going to work.
Link to comment
Share on other sites

Check to see if your Account includes a Redirect script. Cpanel does have one, but I don't know if it runs on a Windows Host, or if your account uses Cpanel.All the script does is write to your .htaccess file, so check to confirm that the .htaccess is allowed on your Hosting account.

Link to comment
Share on other sites

well Dah! Since he's using html pages we are a bit restricted on a solution giving a 301 status message arn't we.i suppose, just thinking aloud here, what if we use the javascript to redirect to php page with PHP 301 RedirectInsert the following code into your web page to create a 301 PHP header redirect. Note that to run PHP in a .htm or .html extension file requires modification of the default Apache Web Server settings, so the use of this as a redirect method is normally restricted to files with the .php extension.<?phpheader("HTTP/1.1 301 Moved Permanently");header("Location: http://www.pagewhatever.com/page.htm");exit();?>or asp 301<%Response.Status="301 Moved Permanently"Response.AddHeader='Location','http://www.mysite.com/'%>or<%@ Language=VBScript %><%' Permanent redirectionResponse.Status = "301 Moved Permanently"Response.AddHeader "Location", "http://www.somacon.com/"Response.End%>i know we are doing two redirects here, but at least it redirects from the still google listed html page, but also will give 301 but not obviously to the html page, and the problem is golum, my precious

Edited by dsonesuk
Link to comment
Share on other sites

I've emailed support with some of the questions that you all have asked, since I am not 100% sure myself. I did look for a script, though, and they did not provide one to do redirects. They have a menu for redirects on the control panel for Linux hosting, but the same is not supported for Windows. I'm surprised that they have not offered a simple alternative in the control panel for Windows users as well, but I'm not sure. I will post whatever information they send back. Thanks for all of the help :).

Edited by stkr
Link to comment
Share on other sites

Okay, this was their response:

Thank you for contacting Online Support. I am sorry for the confusion. Unfortunately windows hosting accounts do not support .htaccess files. If you've redesigned any of the pages of your Web site, but want to maintain your current search engine rankings, you can redirect Web site traffic from your old pages to the new pages without losing your rankings using a "301 redirect."Search engine spiders will transfer your page rank and update any back links to the old page onto the new page when you use a 301 redirect. The code "301" is interpreted as "moved permanently."For example, you can redirect traffic from oldpage.php (.asp or .jsp) to "http://www.newdomain.com/newpage.html" and retain your search engine ranking and back links.Use the code below to redirect traffic to your pages using a 301 Redirect.NOTE: In the code examples below, replace "oldpagename" with the name of your old Web page (the page you want to redirect traffic away from) and replace "newpage.html" with the name of the new Web page to which you want to redirect traffic.PHP Code - save this as oldpagename.php<?phpheader("HTTP/1.1 301 Moved Permanently");header("Location: http://www.newdomain.com/newpage.html");exit();?>ASP Code - save this as oldpagename.asp<%@ Language=VBScript %><%Response.Status="301 Moved Permanently"Response.AddHeader "Location", "http://www.new-url.com"%>Coldfusion'>http://www.new-url.com"%>Coldfusion - save this as oldpagename.cfm<.cfheader statuscode="301" statustext="Moved permanently"><.cfheader name="Location" value="http://www.newdomain.com/newpage.html">ASP .NET - save this as oldpagename.aspxprivate void Page_Load(object sender, System.EventArgs e){Response.Status = "301 Moved Permanently";Response.AddHeader("Location","http://www.new-url.com");}Redirecting to WWW (htaccess Redirect)When using a Linux server with the Apache Mod-Rewrite module enabled, you can create a .htaccess file to ensure that all requests to coolexample.com will redirect to www.coolexample.com, where "coolexample.com" is the name of your domain. The .htaccess file needs to be saved in the root directory of your old Web site, which is the same directory as your index file. You can create a .htaccess file with the following code:RewriteEngine onrewritecond %{http_host} coolexample.com [nc]rewriterule (.*)$ http://www.coolexample.com/$1 [r=301,nc]Redirecting Using IISWhen using a Windows server, you can redirect to a 301 page using IIS.To Redirect to a 301 Page Using IISNOTE:This only applies to dedicated and virtual dedicated servers. 1. In the Internet Services Manager, select the file or folder you want to redirect. 2. From the right-click menu, select a redirection to a URL. 3. Specify the file name of the page to which you want to redirect. 4. Select The exact URL entered above. 5. Select A permanent redirection for this resource. 6. Click Apply.The windows hosting accounts do non support apache. Please provide specific system requirements for the software you are referring to and we would be happy to look further into the matter. At this time the application is not installed on the shared hosting accounts.If this is not what you are referring to please reply back with more information so that we may better assist you.Please let us know if we can assist you in any other way.Best Regards,Online Support Representative
Hope that clears some things up for you all. The problem with what was provided, at least for me at first glance, is that I don't see a way to do this for one .html document. Edited by stkr
Link to comment
Share on other sites

does your windows server support ISAPI_Rewrite see http://www.isapirewrite.com/ which is similar to Apache's mod_Rewrite
I asked and this was the response:
Unfortunately, the best solution is whatever you think is best as we are unable to provide support with scripting related issues. You may want to do a search on your favorite search engine or consult with a community forum online as other users may offer helpful solutions.As for the other questions you asked initially: Windows hosting accounts do not support .htaccess files, no there is not a script we provide for HTML redirects, Windows hosting accounts do not support Apache (that's for Linux) and yes our Windows hosting accounts support ISAPI_Rewrite.Please let us know if we can help you in any other way.
Link to comment
Share on other sites

I do not know how ISAPI_Rewrite works, unfortunately, but if it's the same as Apache's mod_rewrite then that's what you should use. Somebody who's familiar with the module should be able to help you.

Link to comment
Share on other sites

http://www.seoconsultants.com/windows/isapi/301/Here is an example of redirecting an old-page.asp to a new-page.asp...[iSAPI_Rewrite] RewriteEngine On RewriteRule /old-page.asp http://www.example.com/new-page.asp [i,O,RP,L] Just drop the above code in your local httpd.ini file
Does this work the same for an individual html page? And what if I don't have an httpd.ini file?
Link to comment
Share on other sites

just replace old-page.asp with your old website page, replace http://blahblah/new-page.asp with your new domain and new page. if httpd.ini exists upload it, make backup if not empty (save as httpdold.ini) download httpd.ini again to edit, insert amended code into file using notepad, save and upload file back to server, and test.if file does not exist, open notepad insert code, save as httpd.ini and upload to root directory of website.

Link to comment
Share on other sites

Okay, thanks :). One last question. There is already text in the .ini file.

[ISAPI_Rewrite]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# Block external access to the httpd.ini and httpd.parse.errors filesRewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]# Block external access to the Helper ISAPI ExtensionRewriteRule .*\.isrwhlp / [F,I,O]

Should I insert what you have told me to after this? Or does this code need to be erased or anything before I upload?EDIT: Well, I decided to check and see if my second index.html page had made it into ranking on Google (praying that both were not listed), and it turns out that Google has completely removed the 'index.html' and 'index2.html' tag from my site and simply goes to the root, which is of course the index.html anyway. http://www.google.com/search?hl=en&q=l...mp;oq=&aqi= I guess this is great since it's mostly what I was worried about. Now I just have the people who may have bookmarked the index2.html page to worry about.

Edited by stkr
Link to comment
Share on other sites

I'm not sure if it's supposed to take effect immediately or not, but it's been over an hour and it's not working for me.

Link to comment
Share on other sites

I uploaded the httpd.ini file with the following code

[iSAPI_Rewrite]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# Block external access to the httpd.ini and httpd.parse.errors filesRewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]# Block external access to the Helper ISAPI ExtensionRewriteRule .*\.isrwhlp / [F,I,O]RewriteEngine OnRewriteRule /index2.html http://lostvalley-photography.com/index.html [i,O,RP,L]
I'm still not redirected when trying to access index2.html, though.
Link to comment
Share on other sites

It should take effect immediately. Where did you put the file?
In the root folder of my site. :)http://lostvalley-photography.com/index2.htmlYou can still navigate to the page.EDIT: This is becoming way more work then it's probably worth. I'll just delete the page. Since I have a customized 404 Error Page, users will easily be able to navigate to the new home page and update their bookmarks. Thanks for the help everyone :). Edited by stkr
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...