Tiki supports search-engine friendly web addresses (SEFURLs or clean URLs), which are short versions of Tiki URLs, thanks to Apache Rewrite Rules. Some search engine crawlers do not process links with trailing parameters, so transforming the syntax makes the URL more search-engine friendly. By configuring your server properly, Tiki can understand clean URLs so that such short URLs will bring up a Tiki page, and by configuring Tiki properly, Tiki will produce clean URLS and build them into menus, static links, etc. This page explains both steps: how to make Tiki understand and produce clean URLs. See also: htaccess
Here are some examples of how clean URLs work for various types of Tiki pages:
Notice how any text after https://tiki.org/article374-Tiki will work, such as https://tiki.org/article374-Tiki-Passes Thus, the article title can be modified and the URL still works. Canonical URLs are there to inform search engines of the correct one.
If you have Tiki version 1.9.x or greater and are using a web hosting service that uses Apache, then input rewrite rules can be activated as follows:
For better instructions on how to do this see Digital Ocean.
If you manage your server and are using Apache, be sure to
<Directory "/"> ... Options FollowSymLinks AllowOverride FileInfo ... </Directory>
AllowOverride All
If you or your web hosting company is using a web server other than Apache (IIS for example), see your server manual or contact your web hosting service to find out how to activate rewrite rules on your server.
Below are the rewrite rules for different versions of Tiki that pull into the .htaccess file automatically when the steps above for Apache web servers are followed.
https://gitlab.com/tikiwiki/tiki/-/blob/master/_htaccess
Now that your input rewrite rules have been set, you now need to configure Tiki to activate the output rewrite rules so that Tiki will generate SEFURLs internally in menus, static links and elsewhere.
Starting with version 3.0, there is a search engine friendly feature icon directly on the Admin Home page that will look something like this:
Clicking on that icon will bring up the search-engine friendly url admin page (although you could reach this page through the paths described above for previous versions as well):
Search engine friendly url
Selecting the first checkbox will activate the SEFURL feature within Tiki, meaning that some links used in and elsewhere in Tiki will be search-engine friendly. This doesn't work for all links because not all of the templates have been updated, that's why there is a second checkbox...
Search engine friendly url Postfilter
To generate SEFURLs for all Tiki links, also check the second checkbox which creates short URLs by filtering the output. The SEFURL Postfilter consumes more processor (CPU) time than the non-filter version (it deals with all the text and it deals also with cached text like modules while the 'on the fly' filter does not do it. In future versions the SEFURL Postfilter will not be used - it is only necessary until the template SEFURL work is finished. Either one or both features (SEFURL and SEFURL Postfilter) may be used.
List of Url Parameters that should go in the path
This is used if you want a post or get variable to be represented in the sefurl. For instance if you have a url like tw.org/tiki-index.php?page=xxx&lang=en and if you put lang in the setting, the sefurl will be tw.org/en/xxx. You can generalize to any number of parameters. For a setting lang,locale, an url tw.org/tiki-index.php?page=xxx&lang=en&locale=us, the sefurl will be tw.org/en/us/xxx. This setting requires you adapt your .htaccess.
Display article title in the sefurl
Clicking this checkbox will add the title of the article to the url for a link to that article. For instance, tiki-read_article.php?articleId=1 will be transformed into article1-My-article-title. This does not work with the postfilter, only with 'on the fly filter'.
Display blog title in the sefurl
Similar to the article checkbox, clicking this checkbox will add the title of the blog to the url for a link to that blog. This does not work with the postfilter, only with 'on the fly filter'.
As of Tiki16 or greater, you may optionally remove the basic urls from search engine results. This will cause your Clean URL's to show by default in any search engine that uses a robots.txt file (including Google).
When Clean URL's are enabled, it creates a second set of Clean URL's. The original URL's still exist, and by default, search engines will crawl and index them. Removing "duplicate content" is considered to be a good SEO practise and failing to do so generally results in a mild ranking penalty.
To enable this option, open the robots.txt file in your Tiki root directory and uncomment the SEF section by removing the #'s that start new lines. Uncommenting these lines without first completing steps 1 & 2 will prevent your website from being crawled or indexed.
You can customize the rewrite rules but it is important to note that that the input and output rewrite rules are connected, so that if you change one you may need to change the other.
The 'on the fly' filter can use 2 smarty tools: prefilter and a function. Here's an example:
<img src="{$fileId|sefurl:thumbnail}" /> <a href="{sefurl page=$next_info.pageName structure=$home_info.pageName page_ref_id=$next_info.page_ref_id}"> <a href="{$listpages[ix].articleId|sefurl:article:with_next} show_comzone=y#comments">
Both filters use tiki-sefurl.php to rewrite the urls.
Short URL | Short URLs | ShortURL | ShortURLs | ModRewrite | Mod_Rewrite | Friendly URL | Friendly URLs | Clean URL | Rewrite Rules | Rewrite Rule | Clean URLs