Magento always redirect to the path, entered in config/web for each store.
If u try to rewrite my any nginx/apache/xyz rule, magento will re-rewrite it again... so the inifnite loop is being created.
Set the correct path for your magento store in its config/web setting, and it will be working.