Actions

Portal talk

Search Engine Optimisation

From Joomla! Documentation

Revision as of 13:35, 12 February 2011 by Iarp (Talk | contribs)

For some reason the lines $path = str_replace('.'.$suffix, , $path); do not include the two single quotes in between the $suffix and the $path variables. --Dhuelsmann 17:07, 19 May 2010 (UTC)

Change default SEF suffix from .html to anything you want.

You could technically change the suffix to anything you wanted. Just change the myown_suffix to whatever you wanted and add it to the htaccess file.

The only issue being if you use your own suffix it most likely won't fit with proper SEO guidelines/techniques.

 Index: includes/router.php
 ===================================================================
 --- includes/router.php	(revision 13023)
 +++ includes/router.php	(working copy)
 @@ -57,8 +57,13 @@
  			{
  				if($suffix = pathinfo($path, PATHINFO_EXTENSION))
  				{
 -					$path = str_replace('.'.$suffix, '', $path);
 -					$vars['format'] = $suffix;
 +					if ($suffix == 'myown_suffix') {
 +						$path = str_replace('.'.$suffix, '', $path);
 +						$vars['format'] = 'html'; # Leave it alone.
 +					} else {
 +						$path = str_replace('.'.$suffix, '', $path);
 +						$vars['format'] = $suffix;
 +					}
  				}
  			}
 		}
 @@ -93,7 +98,8 @@
  			{
  				if($format = $uri->getVar('format', 'html'))
  				{
 -					$route .= '.'.$format;
 +					//$route .= '.'.$format;
 +					$route .= '.myown_suffix';
  					$uri->delVar('format');
  				}
  			}

.htaccess

Line 67: RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|\.myown_suffix|/[^.]*)$  [NC]

Iarp 18:35, 12 February 2011 (UTC)