I need to redirect all pages for a domain to a subpage called 'emergency'.
However ignore two specific pages - the 'emergency' page itself and another page called 'system'.
I currently have:
AcceptPathInfo On
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111
RewriteCond %{REQUEST_URI} !^/(emergency|system)/?$ [NC]
RewriteRule ^ /emergency? [L,R=301]
RewriteCond $1 !^(index\.php|assets|robots\.txt|cgi-bin|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^/index.php
RewriteCond $1 !.(css|js|png|jpe?g|gif|ico)$ [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]
This does not work.
I have already looked at, but could not get anything working either:
- Apache redirect all sub pages to home page except specific pages
- .htaccess 301 redirect that excludes a subpage
Any help would be appreciated!
Thanks!