Can WordPress be installed at the root level, if a homepage called index.php already exists?

  • 1
    Question is offtopic, please ask at WordPress Q&A – Sathya Dec 24 '10 at 0:59
  • In addition to Sathya's comment, include why you want to do that. – Tyler Dec 24 '10 at 2:20
  • Per Rarst comment below, don't forget about the change when you upgrade if you proceed -- because WP will nuke your file. – Denis de Bernardy Dec 24 '10 at 16:28

In theory, you could rename the file and change the rewrite rule accordingly. Assuming you rename it to wp-index.php, it would look something like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp-index.php [L]

There are a few references to index.php in the WP source, but they're almost all either in the admin area and used to detect or direct to the dashboard, or explicitly for servers that don't fully support mod_rewrite.

| improve this answer | |
  • 1
    Possible, but I think first WordPress update will nuke foreign index.php. – Rarst Dec 24 '10 at 16:20
  • 1
    Very true, but I'll make the assumption that the question's author realizes. :-) – Denis de Bernardy Dec 24 '10 at 16:26
  • 1
    Make index.php read-only. Disable auto-update. (Always test this first). – hakre Dec 26 '10 at 2:58

No, index.php file is present and used in WordPress (source).

Depending on what existing homepage is it can be renamed to another non-conflicting file or migrated to WordPress.

| improve this answer | |
  • Out of curiosity, what would it take to do that? Is it just a matter of .htaccess changes, or are there core hacks necessary as well? – goldenapples Dec 24 '10 at 8:18
  • 2
    You mean renaming? I meant that changing old index.php to some-other-name.php so it is moved to domain.com/some-other-name.php and does not intersect with WordPress. – Rarst Dec 24 '10 at 8:24
  • You can do this in .htaccess or with a filter in your functions.php though it is really a bad idea, so I not going to post it. – Wyck Dec 24 '10 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy