0

If I have a Windows server, is there any possibility I can redirect my index.html to root:

www.example.com/index.html    -> www.example.com
http://example.com/index.html -> http://example.com 

The hosting which I am currently using is not Apache, I am using a Windows server.

Quill
  • 2,729
  • 1
  • 33
  • 44
uttar.ya
  • 3
  • 4

1 Answers1

1

Yet another edit:

Meta Refresh Tag

<meta http-equiv="refresh " content="0; url=www.example.com">

There are two other options we can try if the meta refresh tag just isn't working.

Set the default document. (Simpler)

Web.Config Settings:

<system.webServer>
<defaultDocument enabled="true">
    <files>
        <clear />
        <add value="index.html" />
    </files>
</defaultDocument>
</system.webServer>

Details on setting up via web.config: Setting Default WebPage in IIS 7.5

OR set up via IIS UI (steps 1 through 8 in the HOW TO section): https://www.iis.net/configreference/system.webserver/defaultdocument

Create rewrite rules in IIS. (More difficult)

If we were using Apache, we would create/update the .htaccess file rules:

RewriteEngine On
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]

In IIS, we have to add these rewrite rules in a different way in the web.config. See the following links.

Steps for creating rewrite rules in web.config: IIS URL Rewrite and Web.config

Details on translating .htaccess content to IIS web.config: http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig

OR create Rewrite Rules in IIS UI: http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

Community
  • 1
  • 1
Steve McKisic
  • 83
  • 1
  • 13
  • Hi..Thanks for your reply..I was using that but my site is not stable enough..It like it keeps refreshing and on site tab it always keep refreshing and progressing .. – uttar.ya May 23 '16 at 00:42
  • Are you intending for another document to handle the root traffic, such as index.php? – Steve McKisic May 23 '16 at 00:46
  • I have 2 file index.html and index.htm, On file index.htm..this file have some links within a page which directed to this site..but on same file index.htm i have directed it back to the root..both have the same data displayed but index.html is our final for now..so i have to directed .html back to the roots – uttar.ya May 23 '16 at 01:00
  • See my answer edit above. If i understand what you are trying to do, maybe redirecting to the specific index.htm file will work? – Steve McKisic May 23 '16 at 01:07
  • What are the contents of your website's root folder on the windows web server? Unless your site is configured to processes extensionless urls, there's probably an index file that automatically handles root requests. If we can determine which file handles the root requests, maybe we can forward to that file directly. – Steve McKisic May 23 '16 at 02:26
  • @Steve..my index.html is where my root referring too if any changes made but i don't wanna show :"www.mysite.com/index.html "on my site.all i need is "www.mysite.com" – uttar.ya May 23 '16 at 03:01
  • Any chance you can share your website url? Maybe if I can see the behavior, i can make a better suggestion. Sorry for the Who's on First routine. :) – Steve McKisic May 23 '16 at 03:14
  • can i email it to you?..whats your email address:) – uttar.ya May 23 '16 at 03:19
  • You can send it to stoves3@gmail.com – Steve McKisic May 23 '16 at 03:20
  • I see the constant reloading issue due to the meta refresh tag. So without the meta refresh tag, does the url display as www.mysite.com\index.html? – Steve McKisic May 23 '16 at 03:41
  • Well, i am baffled, but if that does what you need it to do, that's great! I've updated the answer accordingly. – Steve McKisic May 23 '16 at 04:01