Search Engine Friendly URLs

Friendly URLs attempt to mask the fact that your content is being served up by an application by rewriting the URL that Visitors see in their URL bar. For example, Search Engines like to find web pages in the form "some-friendly-page.html", rather than with the form "/index.php?cID=some-unfriendly-id".

With Tribiq CMS you can set an alphanumeric Alias for every HTML page in your site. In this way, if an Alias is "cool-page" then the SE-friendly URL will look like "cool-page.html".

It is recommended that all pages of the HTML content type are made Search Engine Friendly by settings an Alias, thereby giving it a friendly URL. Search Engine Friendly URLs are not only more likely to be indexed by a Search Engine, they are more likely to be remembered by a human.

For example, the following URL:

http://tribiq.com/index.php?cID=my_page

could be written with a .html prefix:

http://tribiq.com/my_page.html

or with no prefix:

http://tribiq.com/my_page

Enabling mod_rewrite Functionality

Search Engine Friendly URLs require mod_rewrite functionality.

The CMS will install and run without mod_rewrite, but if your server supports mod_rewrite then you can use additional features in the CMS.

To enable mod_rewrite features, you should first check that mod_rewrite is enabled in your Apache web server installation. You can then enable Search Enginer Friendly URLs by following one of the following two methods:

1(a). Create a .htaccess file

We have provided the code needed for the two examples above in the htaccess.txt file that comes with the CMS.

Provided Apache is configured to read directives from .htaccess files in your web directory, you can rename the file called htaccess.txt in your installation to .htaccess.

(If you are using a Windows server you may not be able to rename the file using Windows Explorer. However you can work around this limitation by opening it with a text-editor and saving it with a different name.)

1(b). Modify Apache's virtual host file

You will need access to the Apache virtual host file for your site, in order to add two or three lines of code.

If you are running Tribiq CMS from the same directory as your Apache's DocumentRoot, then add the following code for a .html prefix:

RewriteEngine On
RewriteRule ^/([A-Za-z0-9_-]+)\.html$ /index.php?cID=$1 [L]
RewriteRule ^/download~([A-Za-z0-9_-]+)\.html$ /index.php?cID=$1&cType=document&download=1 [L]

or add the following code for no prefix:

RewriteEngine On
RewriteRule ^/admin$ /admin/ [L]
RewriteRule ^/([A-Za-z0-9_-]+)$ /index.php?cID=$1 [L]
RewriteRule ^/download~([A-Za-z0-9_-]+)$ /index.php?cID=$1&cType=document&download=1 [L]

If you are running Tribiq CMS from a subdirectory, then add the following code for a .html prefix:

RewriteEngine On
RewriteRule ^/SUBDIRECTORY/([A-Za-z0-9_-]+)\.html$ /SUBDIRECTORY/index.php?cID=$1 [L]
RewriteRule ^/SUBDIRECTORY/download~([A-Za-z0-9_-]+)\.html$ /SUBDIRECTORY/index.php?cID=$1&cType=document&download=1 [L] 

or add the following code for no prefix:

RewriteEngine On
RewriteRule ^/SUBDIRECTORY/admin$ /SUBDIRECTORY/admin/ [L]
RewriteRule ^/SUBDIRECTORY/([A-Za-z0-9_-]+)$ /SUBDIRECTORY/index.php?cID=$1 [L]
RewriteRule ^/SUBDIRECTORY/download~([A-Za-z0-9_-]+)$ /SUBDIRECTORY/index.php?cID=$1&cType=document&download=1 [L] 

where you should replace SUBDIRECTORY with the name of the subdirectory in which the CMS is installed.

2. Enable Friendly URLs in Site Settings

To enable the Friendly URLs you will also need to enable them in the CMS by changing the mod_rewrite_enabled and mod_rewrite_suffix Site Settings.

You can add a comment here