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... :-)

6 comments:

  1. I recommend to delete the rules that may interfere with this first, then on URL Rewrite Management, press the Add URL Rewrite Button.

    ReplyDelete
    Replies
    1. Thanks for the suggestion, I think that Magento rewrite rules are a bit messy, they should fix it somehow so we don't have to mess with the database :)

      Delete
  2. Thanks a lot, it's very nice to have an extension like that, but if you can't afford it then you can always do the dirty work yourself and change the database :-)

    ReplyDelete
  3. Thanks a lot! I had the same problem and the PHPMyAdmin solution worked for me.

    ReplyDelete
  4. http://www.audiobuy.com.au

    changing category URL's in Magento is very hard...

    ReplyDelete
  5. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! Magento 2 Extension Developer Free

    ReplyDelete