Set Up Short URL’s in ocPortal

Zone Code NameMost Website users expect easy to read website URLs which help a great deal with Search Engine Optimisation so this ‘How To’ deals with how to set up the Short URLs when using ocPortal. Short URLs are easier to remember and follow than having code numbers for pages. There are two options for short URL’s built in to ocPortal. 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

  • Go to the set up section of your Adminzone
  • Click Configuration
  • Choose Site options
  • Scroll down the advanced section

There are two options for adding short URLs; there is normal Short URLs which will give you a URL which will look something like

http://yourwebsiteurl.com/ZONEA/pg/start

There is also new style Short URLs which would be something like:

http://yourwebsiteurl.com/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. If you want to use the second 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:

# These have a specially reduce form (wide is implied)

RewriteRule ^(site|forum|adminzone|cms|collaboration)/galleries/image/([^\&\?]*)\.htm$ $1/index.php\?page=galleries&type=image&id=$2&wide=1 [L,QSA]

RewriteRule ^(site|forum|adminzone|cms|collaboration)/galleries/video/([^\&\?]*)\.htm$ $1/index.php\?page=galleries&type=video&id=$2&wide=1 [L,QSA]

RewriteRule ^(site|forum|adminzone|cms|collaboration)/iotds/view/([^\&\?]*)\.htm$ $1/index.php\?page=iotds&type=view&id=$2&wide=1 [L,QSA]

 # 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 where ever 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 Zone A, Zone B and Zone C, your new section will look something like:

(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)

This will make the new section of code look like the following:

# These have a specially reduce form (wide is implied)

RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/galleries/image/([^\&\?]*)\.htm$ $1/index.php\?page=galleries&type=image&id=$2&wide=1 [L,QSA]

RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/galleries/video/([^\&\?]*)\.htm$ $1/index.php\?page=galleries&type=video&id=$2&wide=1 [L,QSA]

RewriteRule ^(site|forum|adminzone|cms|collaboration|ZONEA|ZONEB|ZONEC)/iotds/view/([^\&\?]*)\.htm$ $1/index.php\?page=iotds&type=view&id=$2&wide=1 [L,QSA]

# 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.

If you want, you can  or Follow me on Twitter

Looking for quality ocPortal Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , | Posted under ocPortal | RSS 2.0

Author Spotlight

Steve Jarvis

Steve Jarvis

Hi I'm Steve, I've been using computers in one form or another since i was 5 with a Dragon 64 and building websites since the late 90's. I'm currently employed as a digital marketing person for Planet X Bikes. When not writing blog posts or working i'm a family man (Wife and Daughter) and a PC Gamer

Leave a Reply

Your email address will not be published. Required fields are marked *


7 + 6 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>