Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Build All - Dynamic mode - mod rewrite

Quote Reply
Build All - Dynamic mode - mod rewrite
Hi all and thanks for your time and patience to see this thread and try to help me ;)

The answer to this question will help me to answer my 2nd question :p

I'm wondering if I need to run the build all process everytime I change something on my directory? because i'm still trying to figured out about the static and dynamic with the mod rewrite.... Unsure sorry but i think i'm cycled on this one.

Any help or guidence on this will be really apreciate it. Again, thanks in advance.

Jesus
Quote Reply
Re: [Jesus] Build All - Dynamic mode - mod rewrite In reply to
Hi. Do you have mod_rewrite setup on your site? If so, then you *don't* need to run any form of "build", as it will automatically update.

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] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy, thanks for your answer. Yes I've mod_rewrite installed. But if I don't run the Build All each time I change something i'm not able to see the changes.

I want to have search engine friendly links and not use the page.cgi to make the links, so how can this be done?

Thanks again,

Jesus
Quote Reply
Re: [Jesus] Build All - Dynamic mode - mod rewrite In reply to
Hi.

Quote:
Yes I've mod_rewrite installed.

..but do you have the .htaccess file setup with the mod_rewrite rules? We offer a service to set this up for you.

Its not actually that hard if you take a look at;

http://www.sqlwidgets.com/...rces/Detailed/2.html

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] Build All - Dynamic mode - mod rewrite In reply to
Thanks again Andy,

So the rewrite rule works for details page?, What about to the actual links for all the sites on all my categories?, Is there a chance to have a rewrite rule for the listing links?

Jesus
Quote Reply
Re: [Jesus] Build All - Dynamic mode - mod rewrite In reply to
Sorry, I'm not with it today Frown

The URL I gave you was for "detailed" pages, using mod_rewrite. The codes you would need can be found by searching the LinksSQL forum, with the following details;

Query: mod_rewrite
User: Andy

Hope that helps (if not, let me know, and I'll point you to the thread).

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] Build All - Dynamic mode - mod rewrite In reply to
Let my search for that. Thanks Andy.
Quote Reply
Re: [Jesus] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy, i'm looking right now at the thread i found:

(http://www.gossamer-threads.com/...=mod_rewrite;#268532)

And i'm starting some tests right now. However, as I was using all the time static pages, i've already all the categories and subcategories created. What i'm trying to do its:

- I don't want to build all my site all the time I made a change (to a link, category, or template).
- I want to have search engine friendly urls on my categories/subcategories and links to all my listings
- I still want to be able to count the links

Is this possible using mod_rewrite? or what else I need to do? (have something done on my admin panel),

Jesus
Quote Reply
Re: [Jesus] Build All - Dynamic mode - mod rewrite In reply to
Hi. You just need something like this in .htaccess;

Code:
RewriteEngine On RewriteRule (.*)\.css $1.css [L]
RewriteRule ^images/(.*) images/$1 [L]
RewriteRule ^AddImages/(.*) AddImages/$1 [L]
RewriteRule ^Images/(.*) Images/$1 [L]
RewriteRule ^p/(.*) /cgi-bin/page.cgi?g=$1 [L]
RewriteRule ^info/(.*) /cgi-bin/page.cgi?p=$1 [L]
RewriteRule ^(.*).html /cgi-bin/page.cgi?g=$1.html [L]
RewriteRule ^$ /cgi-bin/page.cgi [L]

Nothing should need to be done to your templates :)

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] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy.

I have everything working fine (except that i don't and can't use it thru .htacess so i have it in httpd.conf)

Now i need a help on adding one more 'Custom Column' name to the url

original after mod_rewrite

http://www.domain.com/...le_of_the_Link_L123/

What i would want is:

http://www.domain.com/...le_of_the_Link_L123/

or

http://www.domain.com/..._L123_Custom_Column/

Where Custom_Column is in Links table and i would want the value of the column to be there in the 're written url'

If possible, what changes need to be done to the global and the rewrite rule

Thanks
Anup
Quote Reply
Re: [anup123] Build All - Dynamic mode - mod rewrite In reply to
Hi. Which global are you using? It shouldn't be that hard to modify (post it, and I'll help you with the modifications that will be needed).

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] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy.

The following (As Suggested By yogi i think) is the global:

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 . '/';
}

and is called with:

<%if detailed_url%>
<a href="<%rewrite_url($ID,$Title)%>">Details</a>
<%endif%>

[EDIT]
This in httpd.conf

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

Thanks
Anup

Last edited by:

anup123: Jun 29, 2004, 8:10 AM
Quote Reply
Re: [anup123] Build All - Dynamic mode - mod rewrite In reply to
Try the following;

Code:
sub {

my $ID = shift;
my $Title = shift;
my $Extra = 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;
$Extra =~ y/ \t\r\n?"'#/__/d;
return '/' . $cat_url . '/' . $Extra . "_" . $Title . '_L' . $ID . '/';
}

and is called with:

<%if detailed_url%>
<a href="<%rewrite_url($ID,$Title,$FieldName)%>">Details</a>
<%endif%>

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] Build All - Dynamic mode - mod rewrite In reply to
Hi

Worked like charm. Just another bit of addition. I would also want that the Label of the "Custom_Column" is prepended to the "Custom_Column" Value which is now appearing in th re-written url

Thanks
Anup
Quote Reply
Re: [anup123] Build All - Dynamic mode - mod rewrite In reply to
Glad to hear its working.

Afraid i don't understand what you are asking with your other question though :(

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] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy, thanks.

As i've another diectory I ssume that my rules needs to be like this:

Code:

RewriteEngine On
RewriteRule (.*)\.css $1.css [L]
RewriteRule ^images/(.*) images/$1 [L]
RewriteRule ^AddImages/(.*) AddImages/$1 [L]
RewriteRule ^Images/(.*) Images/$1 [L]
RewriteRule ^p/(.*) /cgi-bin/lsq/page.cgi?g=$1 [L]
RewriteRule ^info/(.*) /cgi-bin/lsq/page.cgi?p=$1 [L]
RewriteRule ^(.*).html /cgi-bin/lsq/page.cgi?g=$1.html [L]
RewriteRule ^$ /cgi-bin/lsq/page.cgi [L]


Now, do i still need to build all after using this .htaccess to see the changes?

Jesus
Quote Reply
Re: [Andy] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy

Well i just added the following modification to the global

return '/' . $cat_url . '/' . "Column" . "_Name" . "_" . $Extra . "_" . $Title . '_L' . $ID . '/';

and it gives what i wanted. However, now if i try to type the url (rewritten url which existed even before the global was modified to incorporate the new "Custom_Column") even then the link is accessible which should have given a 404 error. Is this ok? Something of a worry for "Duplicate Content" penalty

Thanks
Anup
Quote Reply
Re: [Jesus] Build All - Dynamic mode - mod rewrite In reply to
Is it meant to be /lsq/ and not /lsql/ ?

Quote:
Now, do i still need to build all after using this .htaccess to see the changes?

The way I test it, is by renaming the index.html (main one), and seeing what the site shows when I goto the main page, and try to view the index.html template (it should show the homepage, even though the index.html file doesn't exist).

Hope that helps.

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] Build All - Dynamic mode - mod rewrite In reply to
Hi Andy.

All static pages the rewrite_url works fine. However, whenevr a dynamic link is accessed (recommend_it.cgi, rate.cgi, contact.cgi etc) then the rewtitten_iurl gives the following:

error : Variable 'rewrite_url' is not a code reference.

Could this be corrected?

TIA
Anup
Quote Reply
Re: [anup123] Build All - Dynamic mode - mod rewrite In reply to
I don't understand why you would pass a .cgi script through the global though?

http://www.yoursite.com/cgi-bin/links/add.cgi?ID=1234 needs to be parsed as that, not through mod_rewrite Unsure

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] Build All - Dynamic mode - mod rewrite In reply to
Hi.

Perhaps i could not explain the error clearly.
Site in static mode all rewrite_url works fine.

recommend_it.cgi (accessed from say the link.html)

part of the code for recommend_it_form.html

You are about to refer the following Business Profile:</b><BR>
<%Links::Utils::load_link%>
....
....
code continues

Now say a user clicks on the rewrite_url link, then the error comes up.

So also is the case with review.cgi etc.

Am i goofing it up somewhere?

Anup