Mobile app version of vmapp.org
Login or Join
Vandalay111

: Rewrite Issue on index.html 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

@Vandalay111

Posted in: #Apache #Htaccess #ModRewrite

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:


Do I need to have index.html file on my public_html directory or I can remove it?
Is my rewrite rule correct?
Based on my rule on .htaccess which page is open : index.html or newindex.php?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay111

2 Comments

Sorted by latest first Latest Oldest Best

 

@Martha676

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]



you can remove the index.html - it's not needed anymore with this rule
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.
the newindex.php

10% popularity Vote Up Vote Down


 

@Murray432

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 www.example.com, the page 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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme