Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Detailed pages and rewrite rules

(Page 2 of 5)
> > > >
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
Hi,

I am using your rewrite rule as:

Code:
RewriteRule ^.*L([0-9]+).*\html$ /db/Detailed/$1.html [L]

and it works well - however I have 4 installations of Links - so how would I make a rule (or rules) that works with the others (different locations - ie /news/Detailed)

Any suggestions?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Detailed pages and rewrite rules In reply to
You'd probably need to use RewriteCond to match the URL so you can then redirect to the correct place.
Quote Reply
Re: [Paul] Detailed pages and rewrite rules In reply to
ermmm - could you show me?

Cheers
Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Detailed pages and rewrite rules In reply to
Assuming you use 4 different domain names then something like:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain1\.com$ [NC]
RewriteRule ^.*L([0-9]+).*\html$ /db/Detailed/$1.html [L]

That's not tested or anything. Just add the same for the other domains ("RewriteEngine On" only once)

Last edited by:

Paul: Apr 14, 2003, 9:53 AM
Quote Reply
Re: [Paul] Detailed pages and rewrite rules In reply to
no the domain name is the same... - that's the problem - jsut 4 installations in 4 different places on the same domain - ie

domain.com/db/
domain.com/news/
etc

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Detailed pages and rewrite rules In reply to
You might be able to use REQUEST_URI instead of HTTP_HOST
Quote Reply
Re: [klauslovgreen] Detailed pages and rewrite rules In reply to
Why not just use a different letter for each installation?

RewriteRule ^.*L([0-9]+).*\html$ /db/Detailed/$1.html [L]

RewriteRule ^.*N([0-9]+).*\html$ /news/Detailed/$1.html [L]

etc.
Quote Reply
Re: [ManuGermany] Detailed pages and rewrite rules In reply to
Does anyone know how I can make the title read from left to right?

IE - CATEGORY should be YROGETAC

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Detailed pages and rewrite rules In reply to
Well, IMO, this is not the correct thread for your question. You should have posted into a separate thread.

Anyway here's a solution. Try this test code:
Code:
my $a = 'test';
my @a = split //, $a;
my $result = join '', reverse @a;
print $result;

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Apr 21, 2003, 4:23 PM
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
Hi Everybody,

When I put a .htaccess file in my root directory with this content:

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

I get an internal server error. What's happening here??

thanks,
Ron
Quote Reply
Re: [rsahertian] Detailed pages and rewrite rules In reply to
I think your missing a . in front of the html$ so try this:

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


If you LinksSQL install isn't building pages in the root directory you'll need to change it to something like this:

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

For example, if the full url to your Detailed pages looks like this: http://www.yourdomain.com/links/Detailed/52.html

Third, you may want to make sure your using the right rewrite global.

If that doesn't work you better try make sure mod_rewrite is even turned on.

Hope that helps! Wink

Jonze
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
Hello,

I use the rule and it is good.

But I do not arrive at touver a solution for <%prev_url%> and <%next_url%> in the page details.

Somebody little to help me

I am not a programmer

Mick
Quote Reply
Re: [mick31] Detailed pages and rewrite rules In reply to
You need a new global for this, get_detailed_url:
Code:
sub {
my $link_id = shift;
my $link_db = $DB->table('Links');

my $link = $link_db->select({ ID => $link_id })->fetchrow_hashref;
my ($cat_id, $cat_name) = each %{$link_db->get_categories ($link->{ID})};

$cat_name =~ tr/ \t\r\n?"'#/__/d;
$link->{Title} =~ tr/ \t\r\n?"'#/__/d;
return "$CFG->{build_root_url}/$cat_name/$link->{Title}" . "_L$link->{ID}/";
}
You can use this global to generate the URL to the previous/next link:
Code:
<a href="<%get_detailed_url($prev)%>">Previous Link</a>
<a href="<%get_detailed_url($next)%>">Next Link</a>

I hope this helps.

Ivan
-----
Iyengar Yoga Resources / GT Plugins

Last edited by:

yogi: Jul 17, 2003, 2:15 AM
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
It is a great help

Thank you, it is very pleasant to work with you all.

Michel

Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
I have a problem.
That gives different addresses


1/ rewrite_url

sub {
my $ID = shift;
my $Title = shift;
my $cats = $DB->table('Links')->get_categories($ID);
my ($cat_id,$cat_full_name) = each %$cats;
my $cat_url = $DB->table('Category')->as_url($cat_full_name);
$Title =~ y/ \t\r\n?"'#/__/d;
return '/' . $cat_url . '/' . $Title . '_L' . $ID . '/';
}

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

=> http://www.mysite.com/areas/cities_L3/

2/ get_detailed_url

sub {
my $link_id = shift;
my $link_db = $DB->table('Links');
my $link = $link_db->select({ ID => $link_id })->fetchrow_hashref;
my ($cat_id, $cat_name) = each %{$link_db->get_categories ($link->{ID})};
$cat_name =~ tr/ \t\r\n?"'#/__/d;
$link->{Title} =~ tr/ \t\r\n?"'#/__/d;
return "$CFG->{build_root_url}/$cat_name/$link->{Title}" . "_L$link->{ID}/";
}

<a href="<%get_detailed_url($prev)%>">Previous Link</a>
<a href="<%get_detailed_url($next)%>">Next Link</a>


=> http://www.mysite.com/country/cities_L3/

----------------
How to obtain the same address for 1 and 2 ?

No - 1/ http://www.mysite.com/areas/cities_L3/
No - 2/ http://www.mysite.com/country/cities_L3/

Yes - http://www.mysite.com/country/areas/cities_L3/

I do not find

Thank you for your assistance

Michel
Quote Reply
Re: [mick31] Detailed pages and rewrite rules In reply to
Try this:
Code:
sub {
my $link_id = shift;
my $link_db = $DB->table('Links');

my $link = $link_db->select({ ID => $link_id })->fetchrow_hashref;
my ($cat_id, $cat_full_name) = each %{$link_db->get_categories ($link->{ID})};

my $cat_url = $DB->table('Category')->as_url($cat_full_name);
$link->{Title} =~ tr/ \t\r\n?"'#/__/d;
return "$CFG->{build_root_url}/$cat_url/$link->{Title}" . "_L$link->{ID}/";
}

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
For : rewrite_url

And for the line :
return '/' . $cat_url . '/' . $Title . '_L' . $ID . '/';

I added
return '/country/' . $cat_url . '/' . $Title . '_L' . $ID . '/';

It is good
But it is right?
I hope not to misuse.

Thank you

Michel
Quote Reply
Re: [ManuGermany] Detailed pages and rewrite rules In reply to
Has anyone figured out how to do this for dynamic pages? I'd like to be able to link to my review.cgi pages with a rewritten link...

Something like this...

http://biketrials.com/...o_Pure_1060_L33.html

or

http://biketrials.com/...o_Pure_1060_L33.html

Instead of:

http://biketrials.com/...ew.cgi?ID=33&d=1

Thanks a lot!

Stephen
Quote Reply
Re: [biketrials] Detailed pages and rewrite rules In reply to
I'll just answer my own question...

.htaccess in review directory:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^.*L([0-9]+).*\html$ /cgi-bin/lsqldev-2.1.2/review.cgi?ID=$1&d=1 [L]

Global:

rewrite_url => sub {
my $tags = shift;
my $Title;

$Title .= "$tags->{'Title'}";

$Title =~ y/ \t\r\n?"'#/__/d;
return 'http://biketrials.com/review/' . $Title . '_L' . $tags->{'ID'} . '.html';
}

Works wonderfully. Now I'll post a new topic with another question... :-)

Stephen
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
Yogi,

Thanks for a wonderful global, It works like a charm,

I have a question about rewrite rule,

Now that we are rewriting the url in this nice format
http://www.mysite.com/nice_title.html from
http://www.mysite.com/Detailed/125.html

Is there a way to write a rewrite rule to do opposite, if some types in or comes through search engine or external link to http://www.mysite.com/Detailed/125.html it automatically redirects to
http://www.mysite.com/nice_title.html

We are asking this because we already have lots of urls indexed by google.

And fear that google might penalize us for having duplicate content.

Any ideas how to solve this problem.

Any help would be appreciated.

Regards.
Quote Reply
Re: [cassandra] Detailed pages and rewrite rules In reply to
I had the same situation at my site (i.e. Google had indexed the 'Detailed/xxx.html' pages before I started using the rewrite rules).

It turned out to be no problem at all: I changed all the links on my site to the nice ones, and after the next indexing round, Google would only list the pages with the nice URLs.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Detailed pages and rewrite rules In reply to
Hi Yogi,



this sounds all very good!

Could you please post a complete! instruction (codes for .htaccess and subs) for such a rewrite-option that works in both, static AND dynamic mode?!



Thanks!

Regards,
Manu

Shopping Portal Shop-Netz.de® | Partnerprogramme | Flugreisen & Billigflüge | KESTERMEDIA e.K. | European Affiliate Marketing Forum.
Quote Reply
Re: [ManuGermany] Detailed pages and rewrite rules In reply to
I just used this on a site, whereas we had 1.5million detailed pages to build... which just wasn't happening :(

Using the same global that Ivan provided, just use this in the .htaccess file;

Code:
RewriteEngine On
RewriteRule ^.*L([0-9]+)/?$ \/cgi-bin\/page.cgi?g=Detailed\/$1\.html [L]

Enjoy Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Detailed pages and rewrite rules In reply to
Hi Everyone,

I'm not using detailed pages -- does anyone know how to use this rewrite to replace the jump.cgi url?

Right now, my links look like this:

http://www.mysite.com/...ump.cgi?ID=1&d=1

I'd like to be able to include the link name in the url and also to make the url look like a static html page rather than including the "?" and "=".

TIA!

ATKOgirl
Quote Reply
Re: [ATKOgirl] Detailed pages and rewrite rules In reply to
You could try sending to something like;

Code:
RewriteEngine On
RewriteRule ^.*JUMPL([0-9]+)/?$ \/cgi-bin\/jump.cgi?ID=$1 [L]

...and then call the jumps with something like;

http://www.yoursite.com/JUMPL<%ID%>/

Not tested, but it should work :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
> > > >