简体   繁体   中英

How to add very long Url Key for CMS Page in Magento 1.9

I am trying to add a very long url to CMS Page programatically, but URLs are being cut.

Here is my code:

$cmsPageData = array(
    'title' => $title,
    'root_template' => 'one_column',
    'identifier' => $endurl,
    'content_heading' => $title,
    'stores' => array(0),//available for all store views
    'content' => $content
);
Mage::getModel('cms/page')->setData($cmsPageData)->save();

When $endurl is something like that

"page/98/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.html"

the record is

"page/98/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

How can I use very long URLs?

In core_url_rewrite table, data type of request_path and target_path fields are varchar(255) .

While in cms_page table data type of identifier field is varchar(100) .

So it's okay to change data type of identifier field to varchar(255) of cms_page table for long URL.

It may not good practice, but if you really needed then you can.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM