How can I redirect to another file but keep index.php access
I will try to explain this in the simplest terms I can think to avoid confusing anyone.
I have a site that I've moved to a sub开发者_运维技巧directory, it will go away soon but for needs access. In the root I have a wordpress install with an index.php file.
Basically for the time being I need this:
User types www.site.com they get taken to www.site.com/comingsoon.php User types www.site.com/index.php they get taken to that actual URL (no redirect)
This is the only line I have in my .HTACCESS:
DirectoryIndex comingsoon.php
but that doesn't seem to work as if they go www.site.com/index.php (by typing that explicitly) they still get redirected to the coming soon page.
I can't rename the index.php from wordpress.
Any help is appreciated.
Try this code in your .htaccess file:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteRule ^/?$ /comingsoon.php [L]
This will only internally redirect www.site.com
or www.site.com/
to /comingsoon.php
. But if you type www.site.com/index.php
it should not do any redirection.
精彩评论