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.
1: Download the latest version from here
2: Extract it and copy the seoUrlManager folder into your Yii extensions folder
3: In your main Yii configuration file define the class for the urlManager Component
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
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
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.
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.
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:
return array( ........ 'components'=>array( 'urlManager'=>array( 'class'=>'ext.seoUrlManager.components.ExtSeoUrlManager', 'cacheID'=>'cache', 'rules'=>array( ''=>'site/index', 'test'=>'site/test', ), 'wwwMode'=>'strip', ), ), );
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.
Total 4 comments
it kinda defeats the purpose of the extension to globally allow query string... so i decided to not implement anything in that direction as of right now... maybe later... right now i will keep that up to individual needs so that if you need query strings you should be able to easily extend ExtSeoUrlManager class on your own...
if u come up with a good idea where query strings are not globally activated let me know please...
Hello again, I considered converting ajax gets to posts but there are many 3rd party plugins so it isn't feasible for us, and also there will be extra future work for new plug-ins.
Actually my current solution is, adding $urlParts['query'] to _connectUrlParts return if query is not empty. It seems to work for me but not sure if it's a complete solution.
Hey zeckon
Thanks for your feedback...
you might be right... one possible solution is to use POST instead of GET. you can define that with the type option in jquery's ajax method.
if you have a sexy solution that comes to your mind just let me know and i will see if i can implement it...
Thanks for the extension, however I encountered a problem, I think removing query string breaks jquery ajax gets.
Leave a comment
Please login to leave your comment.