Ahmad Badpey
Ahmad Badpey

Reputation: 6612

How to redirect all files in a directory to another in root via htaccess

I want to redirect all files (whether it exists or not) in /user directory on my site to a file named temp.php in root directory via .htaccess.

For example, if a user enter user/send.php or user/ or user/send (It may be that not Exists at all), all redirect to temp.php.

How can i do this ?

Upvotes: 6

Views: 3165

Answers (1)

Book Of Zeus
Book Of Zeus

Reputation: 49887

Try this:

RewriteEngine On
RewriteRule ^user/(.*)$ http://domain.com/temp.php [R,L]

Upvotes: 8

Related Questions