Composr Supplementary: Set Up Short URLs in Composr

Written by Steve Jarvis, Sponsored by Arvixe hosting
Image

Adding a zone, setting the zone codename

Adding a zone, setting the zone codename

(Click to enlarge)

Most Website users expect easy to read website URLs, which also help a great deal with Search Engine Optimisation. This 'How To' deals with how to set up the Short URLs in Composr. Short URLs are easier to remember and follow than having code numbers for pages. There are multiple "schemes" for short URLs built-in to Composr. Whichever option you want to use requires the same initial process.

If you haven't already done so you need to log in to FTP and rename recommended.htaccess to .htaccess. If you have already made and edited a .htaccess file you will need to make sure you can combine the changes you have made in to the new .htaccess file. If you don't know exactly what you are doing I recommend asking for help from someone who does as you can break your site if you do this wrong. Once you have done this you can move on to the next step.

The first thing you need to do is log in to your website FTP and locate the options..
  1. Go to the Admin Zone
  2. Navigate to the Setup section of the Admin Zone menu
  3. Choose the Configuration icon
  4. Choose Site options
  5. Scroll down the SEO section

The "URL scheme" option contains a number of different possibilities, including…
  • "Use /pg/ to identify CMS pages" produces URLs like http://yourbaseurl/ZONEA/pg/start.
  • "Use .htm to identify CMS pages" produces URLs like http://yourbaseurl/ZONEA/start.htm.

If you have renamed recommended.htaccess or plain.htaccess to .htaccess you can turn the first of these options on straight away.

Use .htm to identify CMS pages

If you want to use the "Use .htm to identify CMS pages" option you will need to make some changes to the .htaccess file. I only recommend doing this if you have an idea what you are doing.

You will need to add all of your new zones before completing this process and if you add any more zones you will have to make the these changes for the new zones too before they will work.

If you do this please make sure you back up your .htaccess file before you start. Open your .htaccess file and you need to look for the following code which will need to be edited to add your zones to the following code which is located in your .htaccess file:

Code

# HTM STYLE: These have a specially reduced form (no need to make it too explicit that these are Wiki+). We shouldn't shorten them too much, or the actual zone or base URL might conflict
RewriteRule ^(site|forum|adminzone|cms|collaboration)/s/([^\&\?]*)\.htm$ $1/index.php\?page=wiki&id=$2 [L,QSA]
RewriteRule ^s/([^\&\?]*)\.htm$ index\.php\?page=wiki&id=$1 [L,QSA]

# HTM STYLE: These are standard patterns
RewriteRule ^(site|forum|adminzone|cms|collaboration)/([^/\&\?]+)/([^/\&\?]*)/([^\&\?]*)\.htm$ $1/index.php\?page=$2&type=$3&id=$4 [L,QSA]
RewriteRule ^(site|forum|adminzone|cms|collaboration)/([^/\&\?]+)/([^/\&\?]*)\.htm$ $1/index.php\?page=$2&type=$3 [L,QSA]
RewriteRule ^(site|forum|adminzone|cms|collaboration)/([^/\&\?]+)\.htm$ $1/index.php\?page=$2 [L,QSA]
RewriteRule ^([^/\&\?]+)/([^/\&\?]*)/([^\&\?]*)\.htm$ index.php\?page=$1&type=$2&id=$3 [L,QSA]
RewriteRule ^([^/\&\?]+)/([^/\&\?]*)\.htm$ index.php\?page=$1&type=$2 [L,QSA]
RewriteRule ^([^/\&\?]+)\.htm$ index.php\?page=$1 [L,QSA]

The section you need to add is wherever it says:
(site|forum|adminzone|cms|collaboration)

You need to add your zone codenames to this within the code. So, if you are adding three new zones which we will call them ZONEA, ZONEB and ZONEC, your new section will look something like:

Code

# HTM STYLE: These have a specially reduced form (no need to make it too explicit that these are Wiki+). We shouldn't shorten them too much, or the actual zone or base URL might conflict
RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/s/([^\&\?]*)\.htm$ $1/index.php\?page=wiki&id=$2 [L,QSA]
RewriteRule ^s/([^\&\?]*)\.htm$ index\.php\?page=wiki&id=$1 [L,QSA]

# HTM STYLE: These are standard patterns
RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/([^/\&\?]+)/([^/\&\?]*)/([^\&\?]*)\.htm$ $1/index.php\?page=$2&type=$3&id=$4 [L,QSA]
RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/([^/\&\?]+)/([^/\&\?]*)\.htm$ $1/index.php\?page=$2&type=$3 [L,QSA]
RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/([^/\&\?]+)\.htm$ $1/index.php\?page=$2 [L,QSA]
RewriteRule ^([^/\&\?]+)/([^/\&\?]*)/([^\&\?]*)\.htm$ index.php\?page=$1&type=$2&id=$3 [L,QSA]
RewriteRule ^([^/\&\?]+)/([^/\&\?]*)\.htm$ index.php\?page=$1&type=$2 [L,QSA]
RewriteRule ^([^/\&\?]+)\.htm$ index.php\?page=$1 [L,QSA]
You need to make sure every zone you have is added to the code or they will no longer work. Now test your zones to make sure they work ok. If there are any issues you can rename your .htaccess file within your FTP to return to your previous state.

Thank you Arvixe

This tutorial was sponsored by Arvixe hosting.


Feedback

Please rate this tutorial:

Have a suggestion? Report an issue on the tracker.

Back to Top