diff --git a/addons/website/models/website_rewrite.py b/addons/website/models/website_rewrite.py index ba03e4cf5c9fe62aef36388d7aa0e55ffd02e48a..5eea438b89590256ce52c759ac46f1a733f83cf2 100644 --- a/addons/website/models/website_rewrite.py +++ b/addons/website/models/website_rewrite.py @@ -85,10 +85,12 @@ class WebsiteRewrite(models.Model): if rewrite.redirect_type in ['301', '302', '308']: if not rewrite.url_to: raise ValidationError(_('"URL to" can not be empty.')) - elif not rewrite.url_to.startswith('/'): - raise ValidationError(_('"URL to" must start with a leading slash.')) if not rewrite.url_from: raise ValidationError(_('"URL from" can not be empty.')) + + if rewrite.redirect_type == '308': + if not rewrite.url_to.startswith('/'): + raise ValidationError(_('"URL to" must start with a leading slash.')) for param in re.findall('/<.*?>', rewrite.url_from): if param not in rewrite.url_to: raise ValidationError(_('"URL to" must contain parameter %s used in "URL from".') % param)