Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have index.html on my html_directory on my website also I entered a rule as follows:

RewriteRule ^index.html$ newindex.php

It seems requests to my site is routing to my index.html file , my questions are:

  1. Do I need to have index.html file on my public_html directory or I can remove it?
  2. Is my rewrite rule correct?
  3. Based on my rule on .htaccess which page is open : index.html or newindex.php?
share|improve this question

Hope i understand you correctly, you want to define the entry page newindex.php for your directory? There is no need for rewriting, simply define which page acts as the entry page. In the .htaccess file you can define:

DirectoryIndex newindex.php

Now, if anybody calls your directory http://www.example.com, the page http://www.example.com/newindex.php will be shown. The file index.html is not necessary in this case, it's name is just a convention.

share|improve this answer

If you don't want to set DirectoryIndex like martinstoeckli wrote I would improve your rewrite a bit:

RewriteRule ^index\.html$ newindex.php [R=301,L]
  1. you can remove the index.html - it's not needed anymore with this rule
  2. no, not completely. Dots should be escaped in regexp with \. Because it's obviously your old entrypage you should redirect "permanent" (HTTP Statuscode 301) your page.
  3. the newindex.php
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.