: 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
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?
More posts by @Vandalay111
2 Comments
Sorted by latest first Latest Oldest Best
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
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.