Rewrite rule to redirect all subpages to a single page?
- by user784637
I have two two files /etc/apache2/sites-available/foo and /etc/apache2/sites-available/foo_maintenance
The rewrite rule I use in /etc/apache2/sites-available/foo is
<Directory /var/www/public_html>
Options +FollowSymlinks
RewriteOptions inherit
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
</Directory>
so that all mysite.com/* redirect to www.mysite.com
After I take my site down for maintenance, if the user is navigates to a subpage of the site like mysite.com/subdir/something.php I would like to redirect them to www.mysite.com so the index.html of the maintenance page would be displayed.
What is the rewrite rule to redirect all traffic from any subpage to www.mysite.com?