Magento – URL Rewrite Rules in Admin

urlurl-rewrite

I apologize if this is a duplicate request someplace else, but I could not find an easy way to locate it if it exists, so here we go.

I want a simple breakdown how to use the fields in the URL rewrite tool, none of the answers I see give a clear cut simple answer (maybe layman terms are needed to help).

Hopefully others can find this useful as well.

Fields used in the form:

Type: Custom
ID Path: ? – (best way to do this?)

Request Path: ? (is the old url slug such as /earrings/cubic-zircon/bella-gold?)

Target Path: ? – (is the new url path?)

Redirect: No – Yes (simple logic tells me – Yes?)

Description: ? (is this a note relating to why you redirected, internal purposes?)

Thank you for your help in advance on this.

Best Answer

  1. Type

    Custom is the only rewrite type you can create via backend. If you select Product or Category, you can select an existing item which populates some of the fields as a convenience but sets the type to Custom anyway.

  2. Store

    Selects the store (view) your rewrite is intended for.

  3. ID Path (influenced by respectively stolen from Marius)

    This is just a unique identifier for the URL rewrite. It has no impact on the rewrite logic. Its purpose is to identify rewrites programmatically – if you intend to do so.

    For example, product page URLs use product/{product_id} for their id path. Your module might use id paths of the form my_entity_type/{my_entity_id} so you can easily access them later.

    Eventually, a rewrite will work even with a nonsensical id path as long as it's unique per store (view).

  4. Request Path

    This is the path of the original request made by the client/browser marked bold in the following example that is to be rewritten - leading slash omitted: https://magento.example.com/path/to/old/product.html

  5. Target Path

    This is the path you want your visitors to see instead – marked bold in the following example: https://magento.example.com/path/to/new/site.html. This can be an external URL.

  6. Redirect

    You have three options here: no redirect at all, temporary (302) or permanent (301). If you don't want a redirect but rather an internal rewrite of the request – which does a silent rewrite invisible to the user –, go with 'No'. 301 and 302 both send a response with the new location back to the browser which then makes a new request to the given URL, the difference between 301 and 302 being mainly SEO iirc.

  7. Description

    This is purely for internal purposes so you can remember why you made this entry initially – or for any other note related or fully unrelated to this specific rewrite.