Reputation: 7919
I have a domain where I am installing wordpress, but I would like to see the wordpress index1.php only to my ip adress while is under construction. Meanwhile the other visitors they will continue to see index.html as normal.
Redirection:
I tried to do this by modifing .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4
RewriteRule ^(.*)$ /index1.php [L]
I tried few variations but no one works as expected
RewriteRule ^(.*\.html)$ /index1.php [L]
or
RewriteRule ^(.*\.html)$ /index1.php [L]
but it could be the rewrite condition.
Upvotes: 1
Views: 290
Reputation: 785128
Have it this way:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} =1.2.3.4
RewriteRule ^(?:index\.html)?$ index1.php [L,NC]
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
RewriteRule ^(?:index1\.php)?$ index.html [L,NC]
# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteCond %{REMOTE_ADDR} =1.2.3.4
RewriteRule . index1.php [L]
RewriteRule . index.html [L]
Upvotes: 2