Our site exists in several languages. I have installed xmlsitemap module and default link looks like sitename/en/sitemap.xml

I need to remove language prefix just for this link. It seems like there's no settings to disable translation for any specific custom link.

May be I can do it programmatically?


Why not just add a redirect in .htaccess or similar, e.g.?

RewriteRule ^sitemap.xml$ /en/sitemap.xml [R=301,L,QSA]
  • I tried this RewriteRule ^(ru|en)/sitemap.xml$ /sitemap.xml [R=301,L] but got only ERR_TOO_MANY_REDIRECTS – Olelishna May 5 '16 at 10:59
  • Ah, so something else is redirecting requests for /sitemap.xml back to the current or default language version. Probably the xmlsitemap module itself. This might be difficult to fix. Why do you need to change the URL in the first place? If it's just for vanity's sake, the effort required to "fix" might make you think twice – Clive May 5 '16 at 11:02
  • Our SEO specialist makes me cry sometimes ) so we must have only one sitemap url. And it must be accessible without prefix ( – Olelishna May 5 '16 at 11:09
  • 1
    Hmmm, "specialist" might be a bit generous if they genuinely think it matters what the URL of the sitemap is. That hasn't mattered for about 10 years (I'm old enough to have been around in the days when it did). Ask them for a technical explanation of why you need to make this precise change. When they can't answer, smile and say "ok, it stays as it is then!". If they do answer, bring it to the internet to be debunked! – Clive May 5 '16 at 12:18

Hope this will work just add a redirect in .htaccess as

RewriteEngine on
RewriteRule ^en/(.*)$ /$1
  • I don't need to remove prefixes for all site. Just for one link ) – Olelishna May 5 '16 at 11:24
  • ohh right need to modify the rule – rfegade May 5 '16 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.