ISAPI_Rewrite to change a directory / folder. is this right?
Our store app is in our /store/
directory, and I w开发者_开发技巧ant to move it to our main domain. We have tons of links on these URLs so I want to preserve them in the transfer over.
For example:
http://www.mystore.com/store/hammer.aspx would forward to the newly valid URL of http://www.mystore.com/hammer.aspx.
Sometimes our URLs have string data after the .aspx, so that also needs to transfer when in the original URL.
In ISAPI rewrite, if I update my .htaccess, would this code be correct:
RewriteCond %{HTTP_HOST} ^www.mystore.com/store$
RewriteRule ^(.*) http://www.mystore.com/$1 [L,RP]
Is this correct? I'm a little confused on the /$1
syntax.
I would suggest you to fix your config as follows (for ISAPI_Rewrite v3):
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.mystore\.com$
RewriteRule ^store(/.*\.aspx.*) $1 [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*\.aspx.*)$ store/$1 [NC,L]
精彩评论