This question has been flagged
3 Replies
11970 Views

 How can i rename a website page url?

e.g.:

www.example.com/page/page-abc to

www.example.com/page/page-xyz 


Avatar
Discard
Best Answer

On version 10.0, I did it by editing value of "Key" field on the QWeb's form in backend. Go to Settings > Technical > User interface > Views. and search for the QWeb you want to change the URL by the it's t-name.

*Activate the developer mode first. 

Avatar
Discard
Best Answer

Ensure you have activated developer mode in your General Settings, and go to the Website builder in Editor Mode. Navigate to the page you want to change its URL, click on Site > Under 'This Page' > Properties.

Change the URL and Save & Close.

Note that this was done on Odoo Online

Avatar
Discard
Best Answer

Hi Erwin,

If you have this page built in XML it will have an ID. The XML ID refers to a class in a Python file which is inside an http.route and this determinates the page URL.An example for one of the pages I made. The XML:

 <template id="categoryselection">
            <t t-call="website.layout">
              <div id="wrap">
                <div class="container oe_website_sale">
                  <h1 class="mb32">Kies een categorie</h1>
                  <div class="row">
                    <form method="post" class="">
                        <div class="row bg-info" style="padding:15px;margin-top:30px;border-radius:15px;">
                          <div class="form-inline form-group">
                            <label for="afwerking" class="h4">Type afwerking</label>
			    <br />
                            <select id="afwerking" name="afwerking" class="form-control">
                              <t t-foreach="afwerkingen" t-as="afwerking">
                                <option t-att-value='afwerking.id'>
                                  <span t-field="afwerking.name" />
                                </option>
                              </t>
                            </select>
                          </div>
                        </div>
			<input type="submit" class='btn btn-primary pull-right' value='Bevestigen'/>
		   </form>
		  </div>
		</div>
	     </div>
	   </t>
	</template>

As you can see this has a template ID named 'categoryselection'. When you'd open the controller you will find a http route and a function which links to this page. In my example:

    @http.route(['/shop/categoryselection'], type='http', auth="public", website=True)
    //The function for this page
    def categoryselection(self, **post):
	cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
        order = request.website.sale_get_order()
    //Lots of irrelevant code for you after this.

This @http.route is the name of the webpage, so this would for example be http://localhost:8069/shop/categoryselection. By changing this @http.route you can modify the page URL.

I hope this helps you enough.
Yenthe


Avatar
Discard
Author

No, sorry i don't understand what you mean. I just created a webpage trough frontend, and that needs a new url.

Hmm no idea about that sorry.. By the way you should know that its not a good idea to create new webpages etc through the frontend. If you ever update your base module or websites modules you will lose a lot of things due to it not being in the code..

Author

The content pages you make always trough the front end. Looks to me this is how it is intended. The only problem is that if the page name has an error, we can't change it. At least i don't know how.