seourlmanager SEO friendly URLs

Development of seoUrlManager has been DISCONTINUED. There will be no future updates, bug fixes or support.

seoUrlManager is a Yii Framework Extension that extends CUrlManager to make your web application URLs more SEO friendly.

Features

  • No duplicate content with help of 301 redirects
  • Add/strip www in URL
  • Remove entry script from URL
  • Add trailing slash to URL
  • Remove multiple slashes in URL
  • Remove Query String from URL
  • Create unique URLs
  • Automatically configure certain settings of urlManager

Requirements

  • Yii 1.1.8+ (might work on lower versions, not tested)

Installation

1: Extract and copy the seoUrlManager folder into your Yii extensions folder
2: In your main Yii configuration file define the class for the urlManager Component

<?php
return array(
        ........
        'components'=>array(
                'urlManager'=>array(
                        'class'=>'ext.seoUrlManager.components.ExtSeoUrlManager',
                ),
        ),
);

4: Create a file called .htaccess in the same folder as your Yii Entry Script file (index.php) with following content. Adjust filenames as necessary. ~~~ RewriteEngine on

if a directory or a file exists, use it directly

  1. Features
  2. Requirements
  3. Installation
  4. Update
  5. Configuration
  6. Usage
  7. Changelog

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

otherwise forward it to index.php

RewriteRule . index.php ~~~

Update

If you are updating to a new version, delete the seoUrlManager folder inside your extensions folder and repeat steps 1-2 from the installation instructions above.

Configuration

You can basically use the same configuration options that are available in CUrlManager, but most of them will be overwritten or extended by seoUrlManager (useStrictParsing, urlFormat, showScriptName, urlSuffix, caseSensitive, appendParams). Following is a list with new settings that are added by seoUrlManager.

  • wwwMode
  • Define if www should be stripped or added to URL. Deactivate by setting it to false.
  • Available options: 'add', 'strip', false
  • Default: 'add'

Please note that either the rules or the urlRuleClass setting is required for seoUrlManager to work. More info on these two settings can be found here. If you plan on using Gii you will need to add rules as defined here.

Configuration sample:

<?php
return array(
        ........
        'components'=>array(
                'urlManager'=>array(
                        'class'=>'ext.seoUrlManager.components.ExtSeoUrlManager',
                        'cacheID'=>'cache',
                        'rules'=>array(
                                ''=>'site/index',
                                'test'=>'site/test',
                        ),
                        'wwwMode'=>'strip',
                ),
        ),
);

Usage

seoUrlManager does not need any user interaction since everything runs automatically. It is actually a more restricted version of the standard urlManager so expect it not to have certain flexibility since its goal is to create unique and simple URLs in a specific format.

Changelog

  • 1.0.1
  • Fail silently if URL cannot be parsed
  • Adjust error messages and logging parameters
  • Adjust property/method visibility to allow class extensions
  • 1.0
  • Initial release
2 0
10 followers
887 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: limitless
Created on: Aug 21, 2011
Last updated: 9 years ago

Downloads

show all

Related Extensions