How to rewrite all pages on a website to one page

To make all accesses to a website go to a single page, for example during an upgrade, in .htaccess, include the lines

RewriteEngine On
RewriteCond %{REQUEST_URI} !singlepage\.html
RewriteRule .* /singlepage.html [L]
The user will see the usual URL in the address bar, but all requests will be directed to singlepage.html. If you want to change what is shown in the user's address bar, use R as follows:
RewriteEngine On
RewriteCond %{REQUEST_URI} !singlepage\.html
RewriteRule .* /singlepage.html [L,R]
The user will then see the address http://www.example.com/singlepage.html in his address bar.


Copyright © Ben Bullock 2009-2024. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com). / Privacy / Disclaimer