
The simplest configuration is to add the following line in .htaccess file using mod_alias Redirect directive. Cd to your DocumentRoot such as /var/www/html/:
$ cd /var/www/html/
$ vi .htaccess
Append the following line:
Redirect gone /foo/file.html
OR
Redirect 410 /foo/bar/demo.php
You can also use of regular expressions using RedirectMatch directive as follows: