tim peterson
tim peterson

Reputation: 24315

htaccess rule to make index.php be served instead of index.html when go to http://localhost

Could someone provide an .htaccess rule such that my index.php overrides my index.html?

Meaning that index.php, and not index.html, is served when I go to http://localhost.

Upvotes: 2

Views: 1462

Answers (3)

Stevko
Stevko

Reputation: 4495

This may work instead...

RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ index.php [R=301,L]

Upvotes: 2

GoldenNewby
GoldenNewby

Reputation: 4452

In the apache configuration file (or .htaccess), set DirectoryIndex to index.php, instead of index.html

Here is an example: http://www.javascriptkit.com/howto/htaccess6.shtml

Upvotes: 0

Chris
Chris

Reputation: 3121

That will do the job:

DirectoryIndex index.php index.html

In case there is no index.php the index.html file will be served instead.

Upvotes: 4

Related Questions