You are viewing: URL Manager
URL manager enhances Magento url rewrite management by allowing you to replace standard default links with those that are more search engine friendly thus being a great magento url rewriting technique.
This extension provides two-way magento routing (transformation and generation of links). That is, you can now easily rewrite magento product url with category. The key function of our URL manager is to check whether the input link corresponds to the rule, and if it does, to break it into components and then, following internal rules, build the new output link using these constituents. For a better understanding check this example: The example of links transformation.
Reverse link transformation - is a unique option of our Magento URL path manager. It allows you to rewrite any product or category url without changing its direction, i.e. the link will keep functioning as it was before.
For instance: all the links dealing with user profile typically look like this: /customer/account/aaa. If you want the links all over the website to look like /profile/aaa, it means that the system must not only understand all links, but also automatically replace old links with the new ones with no need for you to personally change each code. You should just set the rule /profile/($all) => /customer/account/$1, save it and the links all over the website (including top, footer, links and letters) will be automatically changed according to this rule. This is called reverse transformation — the system changes the standard link format to the one you need, and replaces the old links with new ones where needed. (To better understand how the system generates links, check our example: The example of links generation)
The Main Structures
Below you will find the description of the main structures used for link generation:
$open — requires the word that you set in Module configuration, Open URL prefix. (To learn how to set this word, read here.) This rule is rather specific since it cannot be found in the list of brackets, which means that the following brackets should be treated as the first ones (not the second) as if there is no open-rule;
$numbers — this combination must consist of numbers only;
$node — this combination goes between two slash marks, or between a slash mark and start/end;
$DS — defines whether there will be a slash mark in the link or not. It is recommended to use it only in the end of the link;
$All — indefinite number of symbols, letters and slash marks;
Accessible for All — Both authorized users and guests will be able to access this link;
Via Open URL — a link accessible for guests is used to provide access to some pages for guests using a somewhat transformed link. As a rule it is a link with a prefix in the beginning ($open). This prefix will be automatically changed for all related links by means of a special settings option. Besides, there is one more peculiarity as to how this rule works: If you follow such a link, the same rule will work for other links providing the same level of accessibility, i.e. all links marked as Open URL, will be set to provide access to the resource for all guests. However, keep in mind that the rule does not protect the link, accessed without the use if this rule. For instance, if the page /about/ has not been previously protected, the link /open/about/ will provide access for guests, as required, but the link /about/ will also be accessible for them if you do not set another rule denying access;
Customers Only — the link provides access for authorized users only. It is used to deny access to pages previously accessible for guests;
Access denied — the link is closed for all users with no exception.
The Rules of Links Generation
Standard rules of links generation by means of our URL Manager:
Below you will find a database dump, that can be used to create rewrite rules described above.
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -------------------------------------------------------- -- -- Table Structure `urlmanager_rules` -- CREATE TABLE IF NOT EXISTS `urlmanager_rules` ( `rule_id` int(11) NOT NULL AUTO_INCREMENT, `request_path` varchar(512) NOT NULL, `target_path` varchar(512) DEFAULT NULL, `access` enum('none','guest','open','customer','denied') NOT NULL DEFAULT 'none', `pattern` varchar(512) NOT NULL, `priority` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`rule_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=25 ; -- -- The dump of Data Table `urlmanager_rules` -- INSERT INTO `urlmanager_rules` (`rule_id`, `request_path`, `target_path`, `access`, `pattern`, `priority`) VALUES (1, '($open)/', '/', 'open', '\\/open\\/', 1), (2, '($open)/(men|storefront|women|all|gifts|furniture)/($all)', '/$1/$2', 'open', '\\/open\\/(men|storefront|women|all|gifts|furniture)\\/([\\w\\.\\_\\-\\/]*)', 2), (3, '($open)/(about-magento-demo-store|faq)/', '/$1', 'open', '\\/open\\/(about-magento-demo-store|faq)\\/', 3), (4, '/profile($all)', '/customer/account$1', 'none', '\\/profile([\\w\\.\\_\\-\\/]*)\\/', 4), (5, '/login/', '/customer/account/login/', 'none', '\\/login\\/', 5); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;