Sep 23, 2012

Magento: URL Rewrite Disabled - How to force URL Rewrite



Yesterday I tried to make an URL rewrite or redirect in my local Magento 1.7. I just created a new category and needed it to redirect to the "log in" page.

So I just entered the backend, clicked Catalog -> URL Rewrite Management. The problem was, that the "Target Path" was disabled! So stupid that the Magento team disabled that...

EDIT: You can add Custom URL Rewrites and put any target and request paths if you create a new rule and set the type to "Custom". I recommend to delete the rules that may interfere with this first (system rules created by magento by default), then on URL Rewrite Management, press the Add URL Rewrite Button (upper right). Then on Create URL Rewrite set the value to "Custom". More info here. If you still have problems or want to change system URL rewrites, keep reading ;-)

After trying many approaches (like creating a block, a widget, etc) it was clear that the solution was to access the database directly with PHPMyAdmin and change values manually! So sad that it has to be like that, but well...

Here is the process to change the target path:

  1. You have to open your PHPMyAdmin or similar, then go to your Magento Database.
  2. There, look for a table called "core_url_rewrite".
  3. Browse it... then just look for your desired "request_path", that's the path that will be redirected. The one you want to modify is "target_path". Magento creates that value automatically, but now you can change it. The easy way is to press over it and change it manually.
  4. You are done!Go and test your cool URL Rewrite!!!

Hope it helps you out... :-)