Path Aliases (pathReplaces.php)

JAY6390 edited this page May 14, 2015 · 1 revision

#Path aliases

vQmod lets you use aliases to substitute the more commonly know path with your own renamed path. The most widely used example of this is when you rename your opencart admin directory to something else. Since all the xml scripts reference the admin/ path, this can cause your scripts to fail if you don't change this in each xml manually.

So VQMod has a file called pathReplaces.php, located in the /vqmod directory. You can edit this file and create an alias for a path, such as changing your admin directory to backend or whatever your admin is renamed to. There is an example at the top of that file on how to add it. This prevents you from having to manually edit all your xml files to change the path.

Here is an example that redirects the admin directory to a backend directory.

// START REPLACES //
$replaces[] = array('~^admin\b~', 'backend'); // This replaces the admin directory name to backend in all VQMod xmls automatically
// END REPLACES //

These are regular expression (regex) replaces so be sure you keep the additional characters like ~, \b and ^ as those are important for proper name matching.

Available as of version 2.3.0