blooparksystems / website

Odoo Website builder related addons
GNU Affero General Public License v3.0
10 stars 33 forks source link

Add support for 301 url redirect after the SEO URL Has changed #16

Closed jholze closed 8 years ago

jholze commented 9 years ago

Description

If a SEO URL changes (automatically or manually) a 301 redirect to the new URL must be provided.

Reason

If we haven't a 301 redirect the old URL is no longer accessible and the user is redirected to a 404 page. In addition the article is available twice in the Google search engine which is bad. Result: the Google ranking for the website is decreased.

current behavior

When we change a URL, we must enter the 301 redirect manually.

expected behavior

When we change a URL in the backend odoo should automatically add a 301 redirect to the new URL.

related links

http://stackoverflow.com/questions/9130422/how-long-do-browsers-cache-http-301s

jholze commented 9 years ago

@kaerdsar i added the label v9, should create a ticket to port these changes to v8 or how you handle it ?

kaerdsar commented 9 years ago

Now a page refresh after change seo_url in Promote Panel. Also you can use the old seo_url and the system redirects to the new one. The module saves the old seo_url in order to can redirect, it is not depends of cache.

jholze commented 9 years ago

:+1:

jholze commented 9 years ago

@rruebner maybe you could do a short review tomorrow. Ne need to merge the update to two of our projects

rruebner commented 9 years ago

If #25, #26 and #27 are finished I will do the review.

rruebner commented 9 years ago

@kaerdsar You saved the redirect URLs in a char field. Do you know if the 255 character limitation is used when you don't specify it in the fields.Char definition? If the limitation exists we shouldn't use a char field for the old URLs. Instead of a char field we should use a relation field like one2many for them.

jholze commented 8 years ago

@kaerdsar i also figured out that if you move a menu page, which is a subpage to another page as a subpage, the SEO url does not change. Can you check it

rruebner commented 8 years ago

@kaerdsar The error mentioned by @jholze in the comment before doesn't exist anymore. The redirection refactoring from a char field to an one2many field also works but there is one issue.You have to take into account the language into the redirection relation. Otherwise it is possible that you can call an english url and odoo redirects to the german url.

Steps to reproduce

  1. create a new page in the frontend
  2. change the german SEO url for the new page (/page-new-de-1)
  3. change the english SEO url for the new page (/en_US/page-new-en-1)
  4. change the german SEO url for the new page (/page-new-de-2)
  5. try to open the page /en_US/page-new-de-1: you will be redirected to /page-new-de-2 but you should get a "404 Not found page"
kaerdsar commented 8 years ago

@rruebner I did some changes to avoid this. Anyway there is a case I think we don't need to fix. The first time you set a value to seo_url via Promote Panel for German language Odoo saves the same value for English and German, because in Odoo all default values are in English. To ensure that only exist value for German we would have to set False in English version. Because of this the first time you set a seo_url for German language you actually are setting the value for both languages (de, en) and when set value for English later you actually will be writing a new value. That's the reason you get a redirect for the first url.

I'm not sure if we need a way to avoid this. Also we can have an scenario in the backend to edit redirect URLs.