سؤال

For seo and redirecting old pages, we need to redirect our old mobile site pages to new subdomain. But that doesnt work with the common redirect rule which is

<rule>
    <from>/m/</from> 
    <to type="permanent-redirect">http://m.website.com</to>
</rule>

this is working most of the time as expected like

http://website.com/m/

is redirected to

http://m.website.com

After doing this, we have faced a weird problem. Which is

http://website.com/module/m/

is redirected to

http://website.com/module/http://m.website.com/

Expected is that, it should also be redirected as previously. what's causing the issue?

jfi, our web-application is of struts using UrlRewriteFilter.

هل كانت مفيدة؟

المحلول

After going in deep, i finally came to know that urlrewritefilter is actually setting relative path to root directory in the value of header location in response to the requested path, by only replacing the matching regex pattern, as mentioned above. This can be seen here

Therefore the browser actually interpret this as relative path to the current domain and gives 404 error.

This can be solved using the custom redirect action to handle such type of request.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top