Dynadot

How to redirect index.html to index.php

Spaceship Spaceship
Watch
Hi,

Need some help

how to redirect index.html to index.php

that is:
whenever people try to access my site's index.html, it will then redirect to index.php

regards
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
You can edit .htaccess file
or
delete index.html
or
use <meta http-equiv="refresh" content="5; URL=http://www.yourdomain.com/index.php">
(content="5; = 5 seconds after the current document has finished loading)
 
0
•••
or if a linux server just softlink:

bash# ln -s index.html index.php
 
0
•••
.htaccess:
Code:
RewriteEngine on
RewriteRule index\.html index.php [NC,R]
 
0
•••
or just delete index.htm(l)...or use some javascript in the <head> tag...

Code:
Example: <head><title>...</title><script type="text/javascript">window.location="ADDRESS_TO_INDEX.PHP";</script></head>
 
0
•••
Hi,

Thanks for all your information.

I used this:
<meta http-equiv="refresh" content="5; URL=http://www.yourdomain.com/index.php">

and it works fine.

One more question, which method is better for SEO?
And I heard something like redirect 301, is that better for SEO? How to do that?

daniel
 
0
•••
If you have a php file it will by default go to index.php. I don't have a redirect on any of my pages for that.
 
0
•••
mod_rewrite is your best bet here to insure that the search engines don't make any mistakes.
 
0
•••
0
•••
actually, after having to do this myself and trying all the solutions, I found the .htaccess method to be the best as it was the only solution that doesn't interfere with other subdomains in your account.
 
0
•••
Just removing the index.html file wasn't helping? Try to rename your index.html to index1.html and see if you will access your site directly to your index.php from www.site.com (it should display you the index.php file as primary page).

Wonder why you doing all this redirection procedure...unless you have some other reasons.
 
0
•••
Im not sure about the op, but I wanted to redirect the main hosting domain to a subfolder, rather than having the website in the root of the domain, without changing the virtual paths of the subdomains
 
0
•••
Back