You could just repeat the front controller part and include a condition for your IP address. For example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
### ALTERNATIVE FRONT CONTROLLER FOR SPECIFIC IP ADDRESS
RewriteRule ^index\.WP\.php$ - [L]
# Special case for document root to override DirectoryIndex
RewriteCond %{REMOTE_ADDR} =203.0.113.111
RewriteRule ^$ /index.WP.php [L]
# Route all other requests for specific IP address
RewriteCond %{REMOTE_ADDR} =203.0.113.111
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.WP.php [L]
### DEFAULT FRONT CONTROLLER FOR ALL OTHER USERS
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
This will only route the user with IP address 203.0.113.111
to index.WP.php
. All other visitors get passed through to the default front controller. This still allows any user to directly request index.WP.php
if they want to (if they know it exists).
UPDATE: Note that I've changed the RewriteRule
pattern on the first front controller rule block from .
to ^
- this allows it to match the document root, ie. http://www.example.com/
, so it can override the default DirectoryIndex
.
UPDATE: For the "alternative" front controller (via the specific IP address), a special case is required for the document root in order to override the DirectoryIndex
(ie. index.php
). (The previous update wouldn't have been enough since the document root is obviously a directory, so the preceding condition (!-d
) still fails.)
RewriteRule (.*) http;//www.example.com/$1 [R=301,L]
Note that you have an erroneous semicolon (;
) after the scheme on your canonical non-www to www redirect.