0

Is there a way with ISAPI v3 to allow a subdomain to only hit a specific folder, and all other requests would redirect to www? I also have some urls under this folder that need to be rewritten. There will also be rewrite rules for valid www urls.

Allow:

http://myaccount.mysite.com/account/

http://myaccount.mysite.com/account/profile/

http://myaccount.mysite.com/account/profile/changeEmail.aspx

Allow, but needs to be rewritten:

http://myaccount.mysite.com/account/edit/123456789.aspx

These should be redirected to www:

http://myaccount.mysite.com/directory/

http://myaccount.mysite.com/folder1/

http://myaccount.mysite.com/folder1/folder2/ etc....

Brian Salta
  • 1,576
  • 1
  • 10
  • 18

1 Answers1

0

Try using the following:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC]
RewriteRule ^account/edit/123456.aspx$ /otherpage [NC,L]

RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC]
RewriteRule ^account/.*$ - [NC,L]

RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC]
RewriteRule (.*) http://www.mysite.com/$1 [NC,R=301,L]
Andrew
  • 511
  • 3
  • 7