I encountered this problem when trying to add a product to a fresh Magento 1.4.1 installation:
An error occurred while saving the URL rewrite.
Now this suggests there’s a problem with your .htaccess file or some setting within Magento’s core that is preventing URL rewrites from happening. It isn’t, though…
The Fix:
After altering the permissions on all the subfolders in the ‘media’ folder to Read, Write, Execute (chmod 777) the problem went away.
To do this, I executed a simple SSH command in the magento ‘media’ folder:
find . -type d -exec chmod 777 {} \;
Basically, Magento couldn’t upload images because it didn’t have the correct permissions set in order to do so, so applying the above change fixed that.
It’s such a simple fix (assuming you can use SSH), but you probably wouldn’t expect it to be the solution if you too encountered this error, so hopefully this will save someone a shed-load of hassle in trying to patch this strange problem.
I did reindex data and flush Magento’s cache to be doubly sure that it had worked, before I tested whether or not it had worked by editing the original product I added (which, after a quick search, was there in the database after all, although with this error coming up I did assume the product hadn’t been successfully created at all).



Hey,
Im having the same problem. How do i reindex the data and flush the cache? Never used magento before and its becoming a nightmare.
SanJAY: I uploaded a quick tutorial to walk you through how to flush the cache. Try this post
@SanJAY: There’s also a quick tutorial on how to reindex Magento’s data here