Magento Forum

   
An error occurred while saving the URL rewrite. 
 
Erix
Sr. Member
 
Avatar
Total Posts:  111
Joined:  2008-03-02
 

Hi,

I’ve this error when i try to save a product or reindex data :

An error occurred while saving the URL rewrite.

I’ve try to remove cache, and try to reindax, but the problem are the same .

When i go to reindex page :
Catalog URL Rewrites—SAY “PROCESSING” and never stop…

It’s only since i’ve activated multistore view.

Any idea?

Best regards

 
Magento Community Magento Community
Magento Community
Magento Community
 
wondercorn
Jr. Member
 
Total Posts:  1
Joined:  2010-06-15
 

Someone might able to solve the problem with this

“After altering the permissions on all the subfolders in the ‘media’ folder to Read, Write, Execute (chmod 777) the problem went away.”

My problem went away just by flush magento cache and reindex the data. too bad it’s not working for you though. hmmm

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rahul76
Jr. Member
 
Total Posts:  1
Joined:  2010-10-28
 
wondercorn - 20 July 2010 08:11 AM

Someone might able to solve the problem with this

“After altering the permissions on all the subfolders in the ‘media’ folder to Read, Write, Execute (chmod 777) the problem went away.”

My problem went away just by flush magento cache and reindex the data. too bad it’s not working for you though. hmmm

hi ask for reboot the server

 
Magento Community Magento Community
Magento Community
Magento Community
 
magFlags
Member
 
Total Posts:  45
Joined:  2008-11-02
 

Hello,
are there ny solutions for this issue?
Thanks
Matthew

 
Magento Community Magento Community
Magento Community
Magento Community
 
waidz
Jr. Member
 
Total Posts:  3
Joined:  2010-01-13
 

I tried everything only thing that worked was to flush absolutely everything and run indexing on all. Logged out and back in again and it was fine.
I also ran magento-cleanup.php - available here: http://www.magentocommerce.com/wiki/groups/227/resetting_file_permissions

Very frustrating when these things happen, but good to know for next time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
raleshpatel
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2011-01-01
Ahmedabad
 

Hi please try below steps

The line I commented out to actually get the indexer to work and finish was line 253 in app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php

try {
$this->_getWriteAdapter()->insert($this->getMainTable(), $rewriteData);
} catch (Exception $e) {
//var_dump($e); die();
//Mage::throwException(Mage::helper(\’catalog\’)->__(\’An error occurred while saving the URL rewrite.\’));
}

I hope it\’s work for you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
webrightnow
Member
 
Avatar
Total Posts:  65
Joined:  2010-01-23
Glasgow
 
raleshpatel - 01 August 2011 11:22 PM

Hi please try below steps

The line I commented out to actually get the indexer to work and finish was line 253 in app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php

try {
$this->_getWriteAdapter()->insert($this->getMainTable(), $rewriteData);
} catch (Exception $e) {
//var_dump($e); die();
//Mage::throwException(Mage::helper(\’catalog\’)->__(\’An error occurred while saving the URL rewrite.\’));
}

I hope it\’s work for you.

This solution worked for me after trying absolutely every other suggestion out there with no luck. I have no idea what caused the problem in the first place, it just started happening.
No amount of flushing, re-indexing and deleting cache folders had made any difference.
The only problem with this solution is that it changes a core Magento file, so when you update versions the error will probably crop up again. Also, that function is presumably there for a good reason, is it a good idea to just delete it?
Anyway, as a short term solution I’ll take it until someone comes up with a proper fix.
Why did I ever decide to start building Magento sites? For every step that goes right, at least three go wrong.

 
Magento Community Magento Community
Magento Community
Magento Community
 
josh48202
Jr. Member
 
Total Posts:  26
Joined:  2010-02-02
 

My Solution for 1.6.

Same as above but for 1.6

comment lines 285 and 286 in app/code/core/Mage/Catalog/Model/Resource/Url.php

try {
                $adapter
->insert($this->getMainTable(), $rewriteData);
            
catch (Exception $e{
                
//Mage::logException($e);
                //Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite'));
            
}

re-ran Catalog URL Rewrites then uncommented those to lines and was able to run Catalog URL Rewrites without any issues.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yaroslav Rogoza
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2011-10-20
Ukraine
 

Guys. Commenting exception - it’s not a solution! Rewrite system on your stores still works wrong! Go to the database and open table core_url_rewrite. You don’t find there rewrite records with category paths for some products or even any records for some products. Rewrite engine still fails with errors, you just don’t see it.
Don’t make mistakes.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fr0x
Member
 
Total Posts:  59
Joined:  2009-05-20
 

Guys. Commenting exception - it’s not a solution!

Exactly, commenting out the fact that it is throwing an error just means it doesnt throw the error any more.  It’s still not doing it properly, now it just isn’t telling you so.

In older version it looks like it just dumped the error (somewhere) but at least in 1.6 it dumps the reason to a file.

Look in /var/log/ and you should have an exception.log file that it will dump the reason it is erroring to.

Find that error and fix it to solve this problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AdeshSuryan
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2011-02-25
Delhi
 

Hi Every one ,
Check the solution :

file path : app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Url.php

or

app/code/core/Mage/Catalog/Model/Resource/Url.php

try {
    $adapter
->insert($this->getMainTable(), $rewriteData);
catch (Exception $e{
    
// Bug - the category_id is set to null when the category has a level <= 1
    // So if our product is in 2 differents level 1 categories, the indexer crashes
    
if ($rewriteData[\'category_id\'!= null{
        Mage
::logException($e);
        
Mage::throwException(Mage::helper(\'catalog\')->__(\'An error occurred while saving the URL rewrite\'));
    
}
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
writemcodeboy
Member
 
Avatar
Total Posts:  33
Joined:  2009-09-18
 

@Adesh.
Thanks a ton.  Your solution worked for me on v1.6.2

Do we know if this is an issue in 1.7 ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
OldSpikenetAcc
Jr. Member
 
Total Posts:  10
Joined:  2008-01-28
 

After trying all the suggestion, i just truncated the table core_url_rewrite and then reindexed from Admin panel.
It worked perfectly in version1.6.1.0

 
Magento Community Magento Community
Magento Community
Magento Community
 
bijuthotta
Jr. Member
 
Total Posts:  11
Joined:  2012-02-25
 

hi,

any solution for 1.7? none of the above seems working. any help would be greatly appreciated.

Biju

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nedaplast
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2012-01-03
Nederland
 

Ran into this aswell. Problem occurred after deleting some store views.

Thnx to previous post that had the hint :

// Bug - the category_id is set to null when the category has a level <= 1
// So if our product is in 2 differents level 1 categories, the indexer crashes

Fix :  I just went into system / configuration / manage stores and edit the default store view. Put sorting on 1 or higher ( just not the default 0 ) and save.  Reindex, ( without error this time ) and once done, go back and put it the way it was.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top