PDA

View Full Version : Mod Rewrite


issy
02-07-2007, 01:38 AM
I'm using SEF URLs, I noticed that the directory listing is a number ( http://www.eyelashpros.com/utah/alpine/-l1.html ) I'd like to have the company's name as ( http://www.eyelashpros.com/utah/alpine/company-name-here.html ) for SEO purposes.

Can tis be done?

Thanks

issy
02-11-2007, 06:31 AM
Hello??
Any body out there can help? Dave??

Thanks

Dave Baker
02-12-2007, 01:01 AM
Hello issy,
I'm not confident, but it may be problem with template:
***Open templates/yourTemplate/link-display.tpl and find code***

{if $config.mod_rewrite}
{if 'search' eq $tab}
{assign var="link_title" value=$link.title2}
{else}
{assign var="link_title" value=$link.title}
{/if}
<a href="{$config.base}{$config.dir}{$link.path}/-l{$link.id}.html">{$lang.link_details}</a>
{else}
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}">{$lang.link_details}</a>
{/if}

***Replace with the following code***

{if $config.mod_rewrite}
{if 'search' eq $tab}
{assign var="link_title" value=$link.title2}
{else}
{assign var="link_title" value=$link.title}
{/if}
<a href="{$config.base}{$config.dir}{$link.path}/{convert_str string=$link_title}-l{$link.id}.html">{$lang.link_details}</a>
{else}
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}">{$lang.link_details}</a>
{/if}

***Save file***

issy
02-12-2007, 11:04 PM
Dave,
I forgot to mention that I just upgraded to 2.1, will this code still work?

Thanks

Sergey Ten
02-12-2007, 11:57 PM
Hello issy,
I'm not confident, but it may be problem with template:
***Open templates/yourTemplate/link-display.tpl and find code***

{if $config.mod_rewrite}
{if 'search' eq $tab}
{assign var="link_title" value=$link.title2}
{else}
{assign var="link_title" value=$link.title}
{/if}
<a href="{$config.base}{$config.dir}{$link.path}/-l{$link.id}.html">{$lang.link_details}</a>
{else}
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}">{$lang.link_details}</a>
{/if}

***Replace with the following code***

{if $config.mod_rewrite}
{if 'search' eq $tab}
{assign var="link_title" value=$link.title2}
{else}
{assign var="link_title" value=$link.title}
{/if}
<a href="{$config.base}{$config.dir}{$link.path}/{convert_str string=$link_title}-l{$link.id}.html">{$lang.link_details}</a>
{else}
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}">{$lang.link_details}</a>
{/if}

***Save file***


Hello Dave,

If you talking about the PRO 2.1 then this code doesn't work. Because if you look at index.php you can see this code:


$links = $Category->getLinks($id, $start, $config->get('num_index_links'), $featured_top, $sponsored_top, $gDirEditor['id']);

$p = '';
if($category['id'] != '0')
{
$p = $category['path'].'/';
}

$c = count($links);
for($i=0; $i < $c; $i++)
{
$links[$i]['path'] = $p;
}
$gDirSmarty->assign_by_ref('links', $links);


So.. it is working code:


<a href="{$config.base}{$config.dir}{$link.path}{convert_st r string=$link_title}-l{$link.id}.html">{$lang.link_details}</a>


Without slash ;)

GL

Dave Baker
02-13-2007, 05:46 PM
Hi Sergey,
That code concerns to Pro2.0.x.
Thank for help :good: