AMR - Advanced Mod Rewrite
It rewrites all URIs which are created with cUri class. It is high configurable plugin, you can set how your URI should looks like through dirrefent settings (see screenshot below).
In the Settings area you can make the following settings:
Plugin settings
Enable AMR: through this setting you can enable and disable plugin without deactivation in plugin manager.
Path to .htaccess from DocumentRoot: with this setting you have to define path to the CONTENIDO client from your document root.
Example: http://www.my-contenido-doc-rooot.domain point to the main CONTENIDO folder, you path will be /cms/ -> where "cms" is you CONTENIDO client.
Are several clients maintained in one directory?: If you have more then one client in your CONTENIDO installation, you can prepend client to your URI and use client name instead of id.
Example: http://www.my-contenido-doc-rooot.domain/cms/some-funky-article.html instead of http://www.my-contenido-doc-rooot.domain/1/some-funky-article.html
Should the language appear in the URI (required for multi language websites)?: with this setting you can prepend language to your URI and use language name instead of id.
Example: http://www.my-contenido-doc-rooot.domain/cms/de/some-funky-article.html instead of http://www.my-contenido-doc-rooot.domain/cms/1/some-funky-article.html
Should the name of root category be displayed in the URI?: with this setting you can add the start category to the URI's.
Example: If enabled, the name of the root category (e. g. "Mainnavigation" in a CONTENIDO default installation), will be preceded to the URI.
Configure your own separators with following 4 settings
to control generated URIs to your own taste
Category separator: with this setting you can enter category separator you wish. The possible separators you can see right of the inputs.
Example: If your separator is slash your URI will looks like this example. http://www.my-contenido-page.domain/mymaincategory/mysubcategory/article.html
Category-word separator (delemiter between category words): with this setting you can set category words separator. Taht means if your category has more the one word, the separator will replace blanks.
Example: If your category word separator is underscore your URI will looks like this example. http://www.my-contenido-page.domain/my_category_with_blanks/article.html
Category-article separator (delemiter between category-block and article): with this setting you can select your separator between category and article name.
Example: If your category word separator is underscore your URI will looks like this example. http://www.my-contenido-page.domain/mycategory_myarticle.html
Article-word separator (delemiter between article words): with this setting you can set separator between article words. Article words blanks will be replaced with this separator.
Example: If your category word separator is minus your URI will looks like this example. http://www.my-contenido-page.domain/mycategory/my-article-with-blanks
Append article name to URIs: this settngs appends article name to URI. This setting rewrites article names to defined name.
File extension at the end of the URI: this setting defines file extension at the end of the URI
Should the URIs be written in lower case?: this setting generates URI in lowercase.
Example: http://www.my-contenido-page.domain/MyCategory/MyArticle.html will look like http://www.my-contenido-page.domain/mycategory/myarticle.html
Duplicated content: this setting prevent duplicated content. Depending on configuration, pages could be found thru different URIs. Enabling of this option prevents this.
Examples for duplicated content:
- Name of the root category in the URI: Feasible is /maincategory/subcategory/ and /subcategory/
- Language in the URI: Feasible is /german/category/ and /1/category/
- Client in the URI: Feasible is /client/category/ und /1/category
Percentage for similar category paths in URIs: This setting refers only to the category path of a URI. If AMR is configured to prepend e. g. the root category, language and/or client to the URI, the specified percentage will not applied to those parts of the URI.
A incoming URI will be cleaned from those values and the remaining path (URIpath of the category) will be checked against similarities.
Example: 100 = exact match with no tolerance; 85 = paths with little errors will match to similar ones; 0 = matching will work even for total wrong paths
Redirect in case of invalid articles: This setting provides redirecting to the other article, if requested article was not found.
Moment of URI generation: this setting provides point of URI generation.
a) Clean-URIs will be generated during page output. Modules/Plugins are able to generate URIs to frontend
as usual as in previous CONTENIDO versions using a format like "front_content.php?idcat=1&idart=2".
The URIs will be replaced by the plugin to Clean-URIs before sending the HTML output.
Differences to variant b.):
- Still compatible to old modules/plugins, since no changes in codes are required
- All occurring URIs in HTML code, even those set by wysiwyg, will be switched to Clean-URIs
- All URIs will usually be collected and converted to Clean-URIs at once.
Doing it this way reduces the amount of executed database significantly.
b) By using this option, all Clean-URIs will be generated directly in module or plugins.
This means, all areas in modules/plugins, who generate internal URIs to categories/articles, have to be adapted manually.
All Clean-URIs have to be generated by using following function:
# structure of a normal URI $URI = 'front_content.php?idart=123&lang=2&client=1'; # creation of a URI by using the CONTENIDOs URI-Builder (since 4.8.9), # wich expects the parameter as a assoziative array $params = array('idart'=>123, 'lang'=>2, 'client'=>1); $newURI = cUri::getInstance()->build($params);
Differences to variant a.):
- The default way to generate URIs to fronend pages
- Each URI in modules/plugins has to be generated by UriBuilder
- Each generated Clean-URI requires a database query
Routing: with this setting you can set specific routing rules.
Example: type one routing definition per line as follows:
# {incoming_URI}>>>{new_URI} /incoming_URI/name.html>>>new_URI/new_name.html # route a specific incoming URI to a new page /campaign/20_percent_on_everything_except_animal_food.html>>>front_content.php?idcat=23 # route request to wwwroot to a specific page />>>front_content.php?idart=16
- The routing does not sends a HTTP header redirection to the destination URI, the redirection will happen internally by
replacing the detected incoming URI against the new destination URI (overwriting of article- categoryid) - Incoming URIs can point to non existing resources (category/article), but the desttination URIs should point
to valid CONTENIDO articles/categories - Destination URIs should point to real URIs to categories/articles,
e. g.front_content.php?idcat=23 or front_content.php?idart=34 - The language id should attached to the URI in multi language sites
e. g. front_content.php?idcat=23&lang=1 - The client id should attached to the URI in multi client sites sharing the same folder
e. g. front_content.php?idcat=23&client=2 - The destination URI should not start with '/' or './' (wrong: /front_content.php, correct: front_content.php)
In the functions area you can make the following settings:
Functions
Copy/Download .htaccess template: in this setting you can select the .htacces type. On this point you have two different templates, you can copy or download the template.
Restrictive .htaccess: contains all restrictive settings. All requests with file type js, ico, gif, jpg, jpeg, png, css, pdf will be not rewritten. All other file type will be rewritten to front_content.php.
Folders contenido/', 'setup/', 'cms/upload', 'cms/front_content.php' are excluded from the rewriting. If you want to exclude some another files or folders you have to define it explicit.
Simple .htaccess: contains simply rewriting rules. All request to the valid symlinks, folders or files are excluded from the rewriting. All another requests will be rewritten to the front_content.php.
Reset category-/ and article aliases: with this setting you can reset all or only empty alliases.
In the test area you can test your AMR related settings:
Test
The test area provides testing of the current AMR configuration.
Define options to genereate the URIs by using the form below and run the test: with this setting you can define test params for the current configuration. That can be idcat which is category id, idart which is article id, idcatart which is relation id between category and article
or idartlang which is article id in certain language. After that you can input count of article ids and run test.
After test, you can see how much URI were rewritten, successfull resolved, errors etc.