Actions

Portal talk

Difference between revisions of "Search Engine Optimisation"

From Joomla! Documentation

(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. --~~~~)
 
m (Hutchy68 moved page Talk:Search Engine Optimisation to Portal talk:Search Engine Optimisation: landing pages are now portal pages)
 
(4 intermediate revisions by 2 users not shown)
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>
 +
[[User:Iarp|Iarp]] 18:35, 12 February 2011 (UTC)
 +
 +
== Updating "Add a static text in the <title>" to "Change global page title element" ==
 +
 +
A user should not be editing core Joomla files as whomever wrote this section has instructed.
 +
 +
The only "core" files that should be changed are those in the template folder as per [[Customize the dynamic page title]]
 +
 +
Unless someone has any other reason as to why the core files themselves should be edited, i say this section needs to change to the same information found on [[Customize the dynamic page title]] and set the other page to a redirect to this [[SEO#Add_a_static_text_in_the_.3Ctitle.3E|SEO]] page.
 +
[[User:Iarp|Iarp]] 19:39, 14 February 2011 (UTC)

Latest revision as of 21:31, 10 September 2013

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)

Updating "Add a static text in the <title>" to "Change global page title element"

A user should not be editing core Joomla files as whomever wrote this section has instructed.

The only "core" files that should be changed are those in the template folder as per Customize the dynamic page title

Unless someone has any other reason as to why the core files themselves should be edited, i say this section needs to change to the same information found on Customize the dynamic page title and set the other page to a redirect to this SEO page. Iarp 19:39, 14 February 2011 (UTC)