Reputation: 23
I currently have this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com[/]? [NC]
RewriteCond %{HTTP_HOST} !^example.com/.+ [NC]
RewriteRule (.*) http://testsite.com [R=302,L]
It's not working too well. I need to redirect the root http://example.com
, with or without a trailing slash, but no subdirectories http://example.com/sub
, again, with or without a trailing slash, should be redirected.
Upvotes: 2
Views: 1024
Reputation: 785146
You can use this rule:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^/?$ http://testsite.com [R=302,L]
Upvotes: 1