Jump to content

Custom Integration with SEO Rewriting,


disgruntled

Recommended Posts

whmcs/*

<?php

define("CLIENTAREA",true);

include("dbconnect.php");
include("includes/functions.php");

// update table + set 90 day cookie
if (isset($aff)) {
   update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$aff));
   setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60);
}

// Custom page code
header("HTTP/1.1 301 Moved Permanently");
(isset($_GET["list"]) ? header('location: /billing/packages/' . $_GET['list'] . '.html') : header('Location: ' . $CONFIG["Domain"]))
?>

 

 

whmcs/.htaccess

#Needed wont work without it.
RewriteEngine On

###################################################################

# affiliate -> group rewrite linking like this 
# http://domain.com/whmcs/packages/001/reseller.html (where 001 is affiliate id)
# this rule directs the * file to process a referral

RewriteRule ^packages/([0-9]+)/([a-z0-9_-]+)\.html$ ./*?aff=$1&list=$2 [L,NC]

###################################################################

#package group (triggers if affiliate rule does not)
#this rule will be used a lot if you convert your template to a SEO templating EG making pretty links.

RewriteRule ^packages/([a-z0-9_-]+)\.html$ ./packages.php?list=$1 [L,NC]

###################################################################

#catch all package -> package.php (only if no other rule triggers)

RewriteRule ^packages$ ./packages.php [L,NC]

 

whmcs/.packages.php

<?php

define("CLIENTAREA",true);

require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");

$pagetitle = $_LANG[$list];
$pageicon = "images/support/clientarea.gif";
$breadcrumbnav = '<a href="packages/'.$list.'.html">'.$_LANG[$list].'</a>';

initialiseClientArea($pagetitle,$pageicon,$breadcrumbnav);

if ($_SESSION['uid']) {
 # User is Logged In - put any code you like here
}

#variable name called with {$list} in the .tpl file
$smartyvalues["list"] = $value;

# template file name, just the name not .tpl
$templatefile = "packages";
outputClientArea($templatefile);
?>

 

whmcs/templates/templatename/packages.tpl

{if $list}  {* possibly including eternal .tpl here for ease of reading? *}
	{include file='{$list}.tpl'}
{else}	Default Page (suggest package listing page)
	{include file='packagelist.tpl'}

{/if}

 

 

The above codes are not meant to replace whmcs functionality rather allow you to integrate better with your own site.

Using the above you get several bonuses.

 

SEO affiliate links.

 

SEO package Pages.

 

Build your site around WHMCS.

 

 

Best way to utilise this. (literally build your site around whmcs. by doing that your whmcs installation will be at yourdomain.com and not yourdomain.com/somedirectory/

 

Your sytem urls will be a directory shorter and therefore will in turn be even more SEO Friendly.

 

You can set up lots of mod_rewrite rules to give the illusion of seperate directories for each area.

 

packages

support

knowlegdebase

 

the list goes on but you will see for yourself that if you enter this route it is a large task to do it.

With what i have provided you dont need to do any more to get it working right.

 

One more rule that you might want to use rather than just using

 

whmcs/*?aff=001

 

could be this

 

welcome/001.html

 

this is the rule for that and you can just use it on its own.

RewriteEngine On
RewriteRule ^welcome/([0-9]+)\.html$ ./*?aff=$1 [L,NC]

Link to comment
Share on other sites

whmcs/.packages.php

Should be

whmcs/packages.php

 

One more rule that you might want to use rather than just using

 

whmcs/*?aff=001

 

could be this

 

welcome/001.html

 

Makes more sense to show it like this

 

whmcs/welcome/001.html -> whmcs/*?aff=001

 

Hope the type fix and the revision of the last part make this easier to understand

Link to comment
Share on other sites

<?php

define("CLIENTAREA",true);

include("dbconnect.php");
include("includes/functions.php");

// update table + set 90 day cookie
if (isset($aff)) {
   update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$aff));
   setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60);
}

// Custom page code
header("HTTP/1.1 301 Moved Permanently");
(isset($_GET["list"]) ? header('location: /billing/packages/' . $_GET['list'] . '.html') : header('Location: ' . $CONFIG["Domain"]))
?>

 

 

whmcs/.htaccess

#Needed wont work without it.
RewriteEngine On

###################################################################

# affiliate -> group rewrite linking like this 
# http://domain.com/whmcs/packages/001/reseller.html (where 001 is affiliate id)
# this rule directs the * file to process a referral

RewriteRule ^packages/([0-9]+)/([a-z0-9_-]+)\.html$ ./*?aff=$1&list=$2 [L,NC]

###################################################################

#package group (triggers if affiliate rule does not)
#this rule will be used a lot if you convert your template to a SEO templating EG making pretty links.

RewriteRule ^packages/([a-z0-9_-]+)\.html$ ./packages.php?list=$1 [L,NC]

###################################################################

#catch all package -> package.php (only if no other rule triggers)

RewriteRule ^packages$ ./packages.php [L,NC]

 

whmcs/.packages.php

<?php

define("CLIENTAREA",true);

require("dbconnect.php");
require("includes/functions.php");
require("includes/clientareafunctions.php");

$pagetitle = $_LANG[$list];
$pageicon = "images/support/clientarea.gif";
$breadcrumbnav = '<a href="packages/'.$list.'.html">'.$_LANG[$list].'</a>';

initialiseClientArea($pagetitle,$pageicon,$breadcrumbnav);

if ($_SESSION['uid']) {
 # User is Logged In - put any code you like here
}

#variable name called with {$list} in the .tpl file
$smartyvalues["list"] = $value;

# template file name, just the name not .tpl
$templatefile = "packages";
outputClientArea($templatefile);
?>

 

whmcs/templates/templatename/packages.tpl

{if $list}
	{assign var="specialmsg" value="templates/$template/$list.tpl"}
	{if file_exists($specialmsg)}
		{include file="$template/$list.tpl"}
	{else}
		{$specialmsg}
		{include file="$template/mainpage.tpl"}
	{/if}
{/if}

 

 

The above codes are not meant to replace whmcs functionality rather allow you to integrate better with your own site.

Using the above you get several bonuses.

 

SEO affiliate links.

 

SEO package Pages.

 

Build your site around WHMCS.

 

 

Best way to utilise this. (literally build your site around whmcs. by doing that your whmcs installation will be at yourdomain.com and not yourdomain.com/somedirectory/

 

Your sytem urls will be a directory shorter and therefore will in turn be even more SEO Friendly.

 

You can set up lots of mod_rewrite rules to give the illusion of seperate directories for each area.

 

packages

support

knowlegdebase

 

the list goes on but you will see for yourself that if you enter this route it is a large task to do it.

With what i have provided you dont need to do any more to get it working right.

 

One more rule that you might want to use rather than just using

 

whmcs/welcome/001.html -> whmcs/*?aff=001

 

this is the rule for that and you can just use it on its own.

RewriteEngine On
RewriteRule ^welcome/([0-9]+)\.html$ ./*?aff=$1 [L,NC]

 

 

Note To Admin. I would like you to edit my first post with to the contents of this one and remove the extra posts please

Edited by disgruntled
Admin Message
Link to comment
Share on other sites

whmcs/templates/templatename/packages.tpl

{if $list}
	{assign var="specialmsg" value="templates/$template/$list.tpl"}
	{if file_exists($specialmsg)}
		{include file="$template/$list.tpl"}
	{else}
		{$specialmsg}
		{include file="$template/mainpage.tpl"}
	{/if}
{/if}

 

Added in some tpl file_exist checking, replace the tpl code in above post to this

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated