IIS server doesn’t support .htaccess file!!!
This is a problem for most of us PHP developers. At least for me! Whenever I build a website, the default page is index.php. IIS doesn’t take index.php as the default page. It looks for default.html/index.html etc. I don’t have access to the configuration files of the server. What to do? If anybody have any professional idea, please suggest. I don’t have any idea how to solve this problem.
Then I figured out to use JavaScript. Create an index.html page which will just redirect to the index.php file. Simple… Only a single line to add in the JavaScript code segment:
window.location.href="index.php";
But this method was working for simple website redirection but faced problem when there is some parameters with the URL. Then I figured this following JavaScript code:
var cururl = window.location.href;
var splt = cururl.split('?');
var newurl = 'index.php';
if(splt.length > 1)
{
newurl = 'index.php?'+splt[1];
}
window.location.href = newurl;
I think this would be helpful for some people. If you have any other nice and professional approach to solve this please suggest here.
Leave a Reply