[FIX] website: server_page match trailing slash
After this commit, if an url with trailing slash is not found we fallback to the url without the slash with a redirect to respect seo. With this change we have the same behavior that controllers. We continue to support trailing slash if page explicitely created with / via backend e.g. and for retrocompatibility. task-2346185 closes odoo/odoo#58603 X-original-commit: 3d65424708d1623654756d58d78cec5f8d71276f Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -250,6 +250,10 @@ class Http(models.AbstractModel):
|
||||
# specific page first
|
||||
page = request.env['website.page'].sudo().search(published_domain, order='website_id asc', limit=1)
|
||||
|
||||
# redirect withtout trailing /
|
||||
if not page and req_page.endswith("/"): # / handled by controller
|
||||
return request.redirect(req_page[:-1])
|
||||
|
||||
if page:
|
||||
# prefetch all menus (it will prefetch website.page too)
|
||||
request.website.menu_id
|
||||
|
||||
Reference in New Issue
Block a user