This plugin improves Fancy URLs and enables URLs like: http://example.com/item/2004/01/23/this_is_a_fancy_url
| General Plugin info | |
|---|---|
| Current Version: | 0.4 |
| Code: | fancierurlcode |
| Forum Thread: | here |
To use it, install the plugin and replace /item with this version and replace /archive with this version
Now, in your templates (default location is via Layout > Templates > default/templates), wherever you have a link to an item, put
<%FancierURL%>
In your skins (default location is ./skins/default/sidebar.inc - you may need edit manually with an editor), replace
<%nextlink%>
and
<%prevlink%>
with
<%FancierURL(nextlink)%>
and
<%FancierURL(prevlink)%>
, respectively.
Now you should be able to access an item at http://example.com/item/2004/01/23/this_is_a_fancy_url OR http://example.com/archive/1/2004/01/23/
You can also do: http://example.com/archive/1/2004/01 for January’s archive, etc.
In addition, the old fancyURLs (http://example.com/item/123, http://example.com/archive/1/2004-01) will still work.
On the options page, you can change the name of either the “item” or “archive” portion of the URL (but remember to rename the respective files and change your .htaccess file), and you can select whether you want to use underscores or dashes in the URL.
If you choose to use WordPress-style URLs, add this code to your .htaccess file:
RewriteEngine On
RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(.*) /archive/1/$1/$2/$3/$4
RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2}) /archive/1/$1/$2/$3
RewriteRule ^([0-9]{4})/([0-9]{1,2}) /archive/1/$1/$2
This will give you URLs like:
http://example.com/2004/1/23/this_is_an_item http://example.com/2004/1/23/ http://example.com/2004/1
If you have installed the plug-in correctly and followed the above directions and you have a problem with the link not being displayed properly if you have you have nucleus installed in a subdirectory: (e.g. http://www.domain.com/blogging rather than http://www.domain.com) then you may need to edit the NP_FancierURL.php file. Here’s how:
Your current item link points to: http://www.domain.com/item/2006/5/6/help-fancierurl-doesn-t-work-with-directories
when it should point to: http://www.domain.com/blogging/item/2006/5/6/help-fancierurl-doesn-t-work-with-directories (note the directory “blogging”)
Edit the NP_FancierURL.php file:
function _makeLink($id, $title, $archive = null, $timestamp = null) {
global $CONF;
//$link = $CONF['BlogURL']; (this is commented out by default)
$link = 'http://www.domain.com/blogging'; //just define the URL to point to the directory. note that there's no trailing slash
That should do it!
A newer plugin for Nuclues CMS 3.22 and higher is NP_FancierURL2.