2

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

3
  • 1
    Question is offtopic, please ask at WordPress Q&A
    – Sathya
    Dec 24, 2010 at 0:59
  • In addition to Sathya's comment, include why you want to do that.
    – Tyler
    Dec 24, 2010 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. Dec 24, 2010 at 16:28

2 Answers 2

4

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]
</IfModule>

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.

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

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.

3
  • 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? Dec 24, 2010 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, 2010 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, 2010 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.