Reputation: 952
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 !
Upvotes: 2
Views: 1834
Reputation: 23
In .htaccess of your root directory.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L]
Upvotes: 0
Reputation: 785156
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]
Upvotes: 2