8

I have a mage install with url rewrites turned on, but the server does not do rewrites, so I need to turn rewrites off just to get into admin!

I deleted core_url_rewrite, but did not help.

It would not make sense that this was not possible but I have not found reference to such a table online?

  • 1
    Did you TRUNCATE core_url_rewrite, DELETE FROM core_url_rewrite or DROP TABLE core_url_rewrite? – Mihai Stancu Aug 26 '13 at 15:24
10

The table is core_config_data

Search the path column for web/seo/use_rewrites

Change the value column to 0

Clear your Magento cache so the config table gets re-read.

1

You should login in the backend then go to system->configuration->web->Search Engines Optimization and set the field Use Web Server Rewrites to No. Clear the cache and try again.
You might want to rebuild the indexes also. You shouldn't delete all the values from core_url_rewrite. The reindex process should add the values again.

  • yeah I cant get into admin because rewrites are on. Guess that wasnt clear enough from the question, but I did ask for sql option? And why should I not delete core url rewrite? – Jon Aug 26 '13 at 15:10
  • While you can truncate a table, deleting a table will cause Magento to roll over and die. You then end up having to recreate the table to get Magento back as @Mihai points out. And truncating the wrong table will result in Magento being completely borked with the only option being a full database restore. – Fiasco Labs Aug 26 '13 at 16:43
  • 1
    You should be able to access the backend like this: mysite.com/index.php/admin – Marius Aug 26 '13 at 16:54
1

Along with UPDATE core_config_data SET value = 0 WHERE path = 'web/seo/use_rewrites';.

You need to rebuild the core_url_rewrite table, even if it's empty.

CREATE TABLE `core_url_rewrite` (
    `url_rewrite_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `store_id` smallint(5) unsigned NOT NULL DEFAULT '0',
    `category_id` int(10) unsigned DEFAULT NULL,
    `product_id` int(10) unsigned DEFAULT NULL,
    `id_path` varchar(255) NOT NULL DEFAULT '',
    `request_path` varchar(255) NOT NULL DEFAULT '',
    `target_path` varchar(255) NOT NULL DEFAULT '',
    `is_system` tinyint(1) unsigned DEFAULT '1',
    `options` varchar(255) NOT NULL DEFAULT '',
    `description` varchar(255) DEFAULT NULL,
    PRIMARY KEY (`url_rewrite_id`),
    UNIQUE KEY `UNQ_REQUEST_PATH` (`request_path`,`store_id`),
    UNIQUE KEY `UNQ_PATH` (`id_path`,`is_system`,`store_id`),
    KEY `FK_CORE_URL_REWRITE_STORE` (`store_id`),
    KEY `IDX_ID_PATH` (`id_path`),
    KEY `IDX_TARGET_PATH` (`target_path`,`store_id`),
    KEY `FK_CORE_URL_REWRITE_PRODUCT` (`product_id`),
    KEY `IDX_CATEGORY_REWRITE` (`category_id`,`is_system`,`product_id`,`store_id`,`id_path`),
    CONSTRAINT `FK_CORE_URL_REWRITE_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `FK_CORE_URL_REWRITE_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `FK_CORE_URL_REWRITE_STORE` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=283490 DEFAULT CHARSET=utf8;

Then clear the cache and you may also need to run a reindex in the command line (either reindex all or reindex just the url rewrites).

`php shell/indexer.php reindexall`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.