Censura Support

URLs

All censura requests are run through a single "front controller" script, index.php. For example if you load the URL /index.php?action=someAction... then censura will look for a command (in /system/classes/Commands) called someAction and execute it. The exception to this is if you create a template file in themes/public//static then call an action which does not normally exist, then the action "Static" will be loaded and it look for and display the appropriate template file.

Routing

If you are running Apache however, you can hide these ugly URLs and make it look like you are using separate files for each page, like a static html site. This has many advantages, but mostly that search engines find your pages easier to index. Go to "Admin > Config > URLs" in 2.2 or "Admin > Config > General" before 2.2 and turn on "Search engine friendly URLs (Routing)". This turns on the "routing" system. Censura has a table which maps URLs to parameters, so it can interpret the URL it is passed. This works in reverse, so it can also look up the URL for a given action, meaning we can change the URL site-wide from one place. URLs are retrieved from the template using:

{url action=someAction param1=value1}

...this looks up the URL for the page /index.php?action=someAction&param1=value1, checking whether routing is enabled, and what the neat version of the URL shuold be.

Text URLs

Pre 2.2, if routing was turned on, product/category/vendor pages were given URLs like /products/1.html. Since 2.2, if you go to "Admin > Config > URLs" and turn on "Text URLs", instead of using a number to refer to a product, it will use a text string, for example: /products/my_product/, providing search engine optimisation advantages. The "Text URL" for a product/vendor/category/series is set from it's editing form, once text URLs have been turned on. If you leave it blank, one will be generated from the product name. You can only use legal URL characters in the text URL, so it is limited to a-z, 0-9, - or _. If you are using a UTF-8 character set and latin characters are meaningless for your site, we recommend not using text URLs and using the numerical IDs instead. When you turn text URLs on, you will be redirected to the "fix duplicate text URLs" page. Run this tool as instructed, and it will automatically set a text URL for each item in your database if it is the first time you've turned it on, checking for duplicates and choosing a text URL appropriately. It will also fix any duplicates you have currently in your database, as a duplicate text URL will mean only one of the items sharing that name will be accessible on the site. The "fix duplicate text urls" can be run at any time and should only fill in empty text URLs or add numbers to the end of duplicate URLs, it is accessible from the admin home page. From the "Admin > Config > URLs" page, you can choose from three different types of text URLs for your product pages. You can either list under default category:

/browse/category/subcategory/product/index.html

...or default vendor...

/browse/vendor/product/index.html

...or just products on their own...

/browse/product/index.html

Each product URL need only be unique within it's own classification, for example if you list under vendor, you can have /vendor1/myproduct/index.html and /vendor2/myproduct/index.html (you can use my_product as a text URL for two different products, as long as they have different default vendors). For this reason, if you change this value you must run the duplicate tool afterwards (you will be redirected to it to prompt you to do so), as there may now be duplicate URLs.

Sub-pages of the product are also categorised using the same scheme:

/browse/product/index.html #the product page itself /browse/product/reviews/index.html #view all reviews for a given product /browse/product/reviews/index2.html #the second page of reviews, etc /browse/product/reviews/some_user/ #an individual review by the user with the username "some_user" /browse/product/reviews/add.html #the "write review" page for a product /browse/product/images.html #the image gallery for a product, if there are multiple images

The first part of all these URLs will also change if you change the "list products under" setting. On the "Admin > Config > URLs" page, you can also choose the prefix (the "browse" part of the URL above) for the product/category/vendor/series pages. The product prefix may be the same as the object you are listing the products under, but the others must be different, so that censura knows whether a URL refers to say a vendor or a series. For examplef you list under categories you may have browse as the prefix for both categories and products, but you couldn't have it for vendors as well, as censura wouldn't be able to tell whether the URL /browse/something means the vendor "something" or the category "something". Basically the prefixes for category, series and vendor must be different, because their URLs are otherwise identical.

Vendor URLs will be listed like so:

/<vendor_prefix> #list of vendors /<vendor_prefix>/browse/d #vendors begining with "d" /<vendor_prefix>/suggest.html #vendor suggest page /<vendor_prefix>/my_vendor #the vendor detail page for "my_vendor"

Category URLs will be listed thus:

/<category_prefix> #the root category /<category_prefix>/my_category #the top-level category "my_category" /<category_prefix>/my_category/subcat #the subcategory "subcat" of the category "my_category"

Series URLs will be similar:

/<series_prefix> #the series index /<series_prefix>/my_series #the series detail page for "my_series"

User pages:

/users #the list of users /users/my_username #the user with username "my_username" /users/browse/d #users beginning with "d"

Search:

/<product_prefix>/search.html #the search page



Email newsletter sign up

Sign up to the Censura email newsletter to be kept informed of the latest developments with Censura