Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
9350 Lượt xem

mod_rewrite and .htaccess are only available when hosting through Apache, but that is not a requirement. What is a good way to handle 301 redirects?

Is there a module that handles 301 redirects? Such as Drupal's Redirect module or WordPress's Redirection extension.

Otherwise, what is a good way to get an Odoo module started? Should I look at werkzeug routing?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I know this is an old post, but it is coming up on Google First Page. So I thought it might help someone else.  I had the same problem, as we often move existing websites over from other platforms. I found this module that will handle it for you. 

https://www.odoo.com/apps/modules/10.0/pr1_url_redirect/


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

  You can also do it with jQuery: http://www.opengest.solutions/forum/aide-1/question/odoo-comment-faire-une-redirection-de-page-301-ou-302-12  

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Is there any .htaccess one could write rules not to loose all old urls?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

werkzung RequestRedirect probably.

Ảnh đại diện
Huỷ bỏ
Tác giả

I love upvoting and accepting answers here but a 3 word answer is a bit too thin for that :)

Câu trả lời hay nhất

I am rewritting routes manually in the controller. But I wish I knew a better way.

    @http.route('/my-old-path-to-event/<path:oldpage>', type='http', auth="public", website=True)
    def redirect_to_event(self, oldpage):
        return werkzeug.utils.redirect("/event", 301)

What I would do if I had more time would be to add a field "oldpage_key" on the event model. Then in my controller, search if I kind find my oldpage withing my events.

I think that in order to write a module, you would need to allow configuration through the UI of the controllers.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 23
4117
0
thg 4 25
1445
1
thg 7 24
1791
1
thg 4 24
2235
1
thg 1 24
4874