I have trying to achieve a url rewrite which can be fairly simple but i am unable to figure it out, here is what i want:
i have 2 files
test.html
test.php
my url request is test.html
my htacess rule should return the test.html file , and if test.html file doesnt exists then it should return test.php , the url stays the same i.e. test.html
so in short i want to check if the html file exists then return html file and if it doesnt then return php file.
Any help will be appreciated.. thanks
You should really just do this with default document in Apache no mod_rewrite needed. If you set
test.htmlas the higher priority document it will get chosen if they are both there otherwisetest.phpwill be used if it is the only one there.If you insist on doing this in mod_rewrite the following will work for you