Q:

.htaccess to load specific index file when url not exist

I am updating urls of a project and have this old url:
http://www.example.com/phones/index.php
This folder phones doesnt exists anymore but I want to catch the old traffic and when someone visits this url I want .htaccess file to load file store.php which is located in the root directory
How can I do this with htaccess file so the url in the address bar to stay 
http://www.example.com/phones/index.php but to load store.php file, Thank you in advance !

A:

You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteBase /

RewriteCond %{DOCUMENT_ROOT}/$1 !-d
RewriteRule ^([^/]+)/index\.php$ store.php [L,NC]

