Search Engine Optimisation: Difference between revisions
From Joomla! Documentation
Dhuelsmann (talk | contribs) New page: 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. --~~~~ |
|||
| Line 1: | Line 1: | ||
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. | 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. | ||
--[[User:Dhuelsmann|Dhuelsmann]] 17:07, 19 May 2010 (UTC) | --[[User:Dhuelsmann|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. | |||
<pre> | |||
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, <nowiki>''</nowiki>, $path); | |||
- $vars['format'] = $suffix; | |||
+ if ($suffix == 'myown_suffix') { | |||
+ $path = str_replace('.'.$suffix, <nowiki>''</nowiki>, $path); | |||
+ $vars['format'] = 'html'; # Leave it alone. | |||
+ } else { | |||
+ $path = str_replace('.'.$suffix, <nowiki>''</nowiki>, $path); | |||
+ $vars['format'] = $suffix; | |||
+ } | |||
} | |||
} | |||
} | |||
@@ -93,7 +98,8 @@ | |||
{ | |||
if($format = $uri->getVar('format', 'html')) | |||
{ | |||
- $route .= '.'.$format; | |||
+ //$route .= '.'.$format; | |||
+ $route .= '.myown_suffix'; | |||
$uri->delVar('format'); | |||
} | |||
} | |||
</pre> | |||
.htaccess | |||
<pre> | |||
Line 67: RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|\.myown_suffix|/[^.]*)$ [NC] | |||
</pre> | |||
Revision as of 18:35, 12 February 2011
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]