Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Detailed pages and rewrite rules

(Page 4 of 5)
> > > >
Quote Reply
Re: [ken707] Detailed pages and rewrite rules In reply to
I talked to the webhost provider and they said that mod rewrite is installed.

Laura has helped me with this and so we determined that the rewrite is not rewritting.
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
I am having some questions
  1. Does this rewrite function also works with the latest version of Links SQL
  2. Lets assume a directory implements this function on their website, and then Links SQL comes up with newer version, during such circumstances, it is more likely that the same rewrite rule might not work and hence it can prove very much damaging to the website as all the incoming links (people linking to their website within the directory) would appear to be dead link.

Sorry if the questions sounds silly, but I was just wondering if there is a work around this projects or I would like to request to GT team to implement such option within their software so that along/insead of builing pages with number.html it can also build pages with the url like link-name.html

Thank you.

Vishal
-------------------------------------------------------
Quote Reply
Re: [NeedScripts.Com] Detailed pages and rewrite rules In reply to
Hi,

Yes the rewrite rules will work with the current version.

Actually, in my opinion rewrite rules are good precisely because of possible software changes - if the actual url of the page changes, you just update the rule. This way your viewed url can stay the same whatever happens to the underlying url.
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
Hi Laura, thanks for the very informative reply. It is very much appreciated.

Okay here are few more quesitons.... I hope you guys will be able to help me out.
  • Out Static / Dynamic - Do I have to generate static pages or have to use it dynamically? or I can use it either way and it does not make any difference?
  • Also, what is there are 2 or more sites with the same "Title" ?

Thank you for all the help.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [NeedScripts.Com] Detailed pages and rewrite rules In reply to
~ Bump ~

anyone?

Vishal
-------------------------------------------------------
Quote Reply
Re: [NeedScripts.Com] Detailed pages and rewrite rules In reply to
Generally you would be using rewrite rules because you want you site to appear static when it is actually dynamic. I don't think there is any reason why you couldn't rewrite to a static page - you just need to think about why you're using rewrite rules.

The rules use the ID of the link - not the title. You just put the title in the link to look nice and for search engine optimisation.

Laura.
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
Hi.

I am using the rewrite rule global as suggested by yogi, all works too well in static mode. Also reading somewhere on GF forum regarding 128 limit on url lebgth by google for indexing, i have the same with url rewritten to:

http://somsite.com/...Unique_ID_Title_LXXX

where Some_Unique_ID is a custom column added to the Links table and the same also appears on title.

The prev and next links have also been rewritten. However, in dynamic mode, the rewritten url fails. Could the same be made to work in dynamic mode too. currently my rewrite in httpd.conf is as follows:

RewriteEngine On
RewriteRule ^.*L([0-9]+)/?$ /Detailed/$1.html [L]

and the rewrite_url global is as follows:

Quote:
sub {
my $ID = shift;
my $Title = shift;
my $LocatorID = shift;
$Title =~ y/ \t\r\n?"'#/__/d;
$LocatorID =~ y/ \t\r\n?"'#/__/d;
return $CFG->{build_detail_url} . '/' . "Locator" . "_ID" . "_" . $LocatorID . "_" . $Title . '_L' . $ID . '/';
}


Called in template as <%rewrite_url($ID,$Title,$LocatorID)%>

The problem in dynamic mode is that it comes up with a 404 error like this:

Unable to find detailed page: 'Detailed/Locator_ID_ASFXFX_Site_Title_L41/

Could this be made to work both in static as well as dynamic mode? What do i need to change?

TIA
Anup

Quote Reply
Re: [anup123] Detailed pages and rewrite rules In reply to
Hi,

Try replacing $CFG->{build_detail_url} in your global with /Detailed as the $CFG->{build_detail_url} will be written as something different under dynamic urls.

On another note, I don't understand why you have added a Locator ID? You seem to be making it unnecessarily complicated - unless you are using this for something else?
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
Hi.

return '/' . "Detailed" . '/' . "Locator" . "_ID" . "_" . $LocatorID . "_" . $Title . '_L' . $ID . '/';
}

This worked :)

Thanks A Lot.
Anup
Quote Reply
Re: [anup123] Detailed pages and rewrite rules In reply to
Sorry to ask silly question, but is it possible to actually build static pages (.php or .html) using above info? so that the url for detailed page would look something like www.domain.com/L_title_name_ID.php ? (I do plan to insert few php tags on the page).

Thank you for the help.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Detailed pages and rewrite rules In reply to
Hello,
I use the rewrite in static mod and it works great.

I'm trying to set it up on the detailed page itself to direct users to the next or prev links in the category on a static detailed page.

if I use

<a href="<%rewrite_url($ID,$Title)%>">Previous Site</a>

It shows the current sites title with the prevous sites Id number. How could I get it to display the prevs sites title?

Any ideas...
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
I meant if i show

<a href="<%rewrite_url($prev,$Title)%>">Previous Site</a>
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
carminejg3, I am doing that with my site and it works nicely. I'll try to document what I have, it might help you.

I have a global called 'nextprev' which is included in detailed.html just after the body tag as <%nextprev%>. This global contains:

Code:
sub {
my $args=shift;
#my $cat_id = $IN->param('catID');
my $db = $DB->table ('Category','CatLinks');
my $cat_id = $db->select ( { 'CatLinks.LinkID' => $args->{ID} }, ['Category.ID'] )->fetchrow_array;

my $catlnk_db = $DB->table ('Links', 'CatLinks');
$catlnk_db->select_options ("ORDER BY $CFG->{build_sort_order_category}") if ($CFG->{build_sort_order_category});
my $sth = $catlnk_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' }, [ 'Links.ID' ,'Links.Title'] );
my ($next, $prev, $next_title, $prev_title, $Title);
while (my ($id,$title) = $sth->fetchrow_array) {
if ($id == $args->{ID}) {
($next,$next_title) = $sth->fetchrow_array;
last;
}
else {
$prev = $id;
$prev_title = $title;
}
}
my ($next_url, $prev_url);
if ($next) {
$Title = $next_title;
$Title =~ y/ \t\r\n?"'#/-/d;
$next_url = "/detail/$Title-L$next.html";;
}
if ($prev) {
$Title = $prev_title;
$Title =~ y/ \t\r\n?"'#/-/d;
$prev_url = "/detail/$Title-L$prev.html";;
}
return {next_url => $next_url, next_title => $next_title, prev_url => $prev_url, prev_title => $prev_title};
}

Then, where I want the next previous links to display I use this piece of code:

Code:
<%if $prev_url%>
<p>Previous link: <a href="<%prev_url%>"><%prev_title%></a></p>
<%endif%>
<%if $next_url%>
<p>Next link: <a href="<%next_url%>"><%next_title%></a></p>
<%endif%>

I'm not sure if that will help you but it might give you something to go on.
Quote Reply
Re: [aus_dave] Detailed pages and rewrite rules In reply to
Thanks, dave.. I'll see what i can figure out.... with the rewriting

This works I just get

Previous link: Unknown Tag: 'prev_title'
Next link: Unknown Tag: 'next_title'

I also have to figure out how to be able to use the rewrite mod from above with these of i would look like i'm submitting two different urls with one page.

/detailed/1234.shtml
/websites/thisone/HappySitesL1234
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
well I've benn trying and no luck...

does anyone know how to get the prev and next links to display the rewrite to the next links... also to display the sites title in the url?

any help would really be great.

Carmine
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
If you are getting unknown tag errors then the global isn't working. Are you sure that you have a tag calling the global in your template - it needs to be above any tags for <%next_url%> etc.

For example, if you have called the global nextprev, you need the tag <%nextprev%> somewhere near the top of your page.
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
I am calling the global <%nextprev%> and I'm using this sub.

sub {
my $args=shift;
#my $cat_id = $IN->param('catID');
my $db = $DB->table ('Category','CatLinks');
my $cat_id = $db->select ( { 'CatLinks.LinkID' => $args->{ID} }, ['Category.ID'] )->fetchrow_array;
my $catlnk_db = $DB->table ('Links', 'CatLinks');
$catlnk_db->select_options ("ORDER BY $CFG->{build_sort_order_category}") if ($CFG->{build_sort_order_category});
my $sth = $catlnk_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' }, [ 'Links.ID' ,'Links.Title'] );
my ($next, $prev, $next_title, $prev_title, $Title);
while (my ($id,$title) = $sth->fetchrow_array) {
if ($id == $args->{ID}) {
($next,$next_title) = $sth->fetchrow_array;
last;
}
else {
$prev = $id;
$prev_title = $title;
}
}
my ($next_url, $prev_url);
if ($next){
$Title = $next_title;
$Title =~ y/ \t\r\n?"'#/-/d;
$next_url = "/detail/$Title-L$next.html";;
}
if ($prev) {
$Title = $prev_title;
$Title =~ y/ \t\r\n?"'#/-/d;
$prev_url = "/detail/$Title-L$prev.html";;
}
return {next_url => $next_url, next_title => $next_title, prev_url => $prev_url, prev_title => $prev_title};
}


I thought I would only need the prevnext tag, but This doesn't seem to be working...
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
In Reply To:
I am calling the global <%nextprev%> and I'm using this sub.

I thought I would only need the prevnext tag, but This doesn't seem to be working...[/quote]

Is this just a typo in your post?
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
yes sorry. The global is called

nextprev

then the above sub is the code.

But it seems when every I try to call it in the detailed page as <%nextprev%> it doesn't show
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
When you put <%nextprev%> in the page, it wont show anything because it is just setting tags.
If you put <%nextprev%><%next_title%> then you should get the next title.
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
Thank you.....

I was trying things like so.
<a href="<%nextprev($next_url)%>"><%nextprev($next_title)%></a>
<a href="<%nextprev($prev_url)%>"><%nextprev($prev_title)%></a>


THEN I ran

<%nextprev%><%next_title%>
<%next_url%>

I got.

<!--
Boating, Fishing, Diving in Florida.
/detail/Boating,-Fishing,-Diving-in-Florida.-L12098.html
-->

so all i need is
<%nextprev%>
<a href="<%next_url%>"><%next_title%></a>

is there a way to use the mod_rewrite to have the "detail" in the link be changed to the rewritten url?

so the url would look like

/cat1/cat2/cat3/Boating,-Fishing,-Diving-in-Florida.-L12098.html
Quote Reply
Re: [carminejg3] Detailed pages and rewrite rules In reply to
One other question

How could I request more then just the next and prev links from the category?
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
To get the categories to use in the url try:

my ($cat_id,$cat_name) = $db->select ( { 'CatLinks.LinkID' => $args->{ID} }, ['Category.ID','Full_Name'] )->fetchrow_array;

I think you'll also need to use $db->as_url($cat_name) to remove spaces etc. Try searching the forum for as_url to see how to use this.

You'll need to be more specific about which other Links you want returned before someone can help you with that.
Quote Reply
Re: [afinlr] Detailed pages and rewrite rules In reply to
Well,
I wanted to grab say a random 5 links from the current category so I could include a relate sites list.

but using the mod-rewrite..

or my links would look like they are in two places with different names.


Also for some reason I'm getting some errors in the logs saying that /thesitename_L/ is missing, and thats becasue the re-write is missing some of the link ID's should be /thesitename_L1234/

thank you for the help.
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
ita great mod!

but here is what I find there:
http://www.shop-netz.de/cgi-bin/shop/page.cgi?g=Bekleidung-und-Schmuck%2FHerrenmode%2Findex.html;d=1

see the links to the detailed pages:
they looks like:
http://www.shop-netz.de/Baur-von-Menschen-fuer-Menschen_J6811.html

how its possible to use "-" not a "_" in for the the title?
> > > >