When my simple apache webserver hits index.php it redirects to index.html however in the url instead of rooturl.com its example.com/index.html. Is there a simple way to fix this?
header( 'Location: /index.hmtl') ;
www.example.com
There can only be 1 default directory index file. Either http://example.com/ resolves as http://example.com/index.html or http://example.com/index.php. You can't have both work at the same time.
Instead of redirect to different index.html for different language, I think you should consider to directly include the HTML file. For example,
<?php
// index.php
switch (some_get_user_language_func()) {
case 'en':
include './index.en.html';
case 'es':
include './index.es.html';
case 'fr':
include './index.fr.html';
default:
include './index.en.html';
}
Alternatively, you may try Apache's mod_negotiation to switch HTML file without the index.php file.
header("Location: /");?index.phpwhen there's no filename, since you'll just keep redirecting to the PHP file. You have to put a filename if you want it to redirect to a different page.