Reputation: 885
I want to do following redirects:
http://example.com to some static page
http://exmaple.com/<anything> to http://subdomain.example.com/<anything>
Currently i have this:
RewriteRule ^/?$ static/index.html [L]
RewriteRule ^(*)?$ http://sub.example.com/$1 [L]
Any help is appreciated. Thanks
Upvotes: 0
Views: 52
Reputation: 41219
You can try these rules :
RewriteEngine on
#1)This will redirect the homepage of example.com to /static/index.html#
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^$ /static/index.html [NC,L]
#2)This will redirect /anything to sub.example.com#
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteCond %{REQUEST_URI} !^/static/index\.html [NC]
RewriteRule ^(.+)$ http://sub.example.com/$1 [NC,L,R,NE]
Upvotes: 1