Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re-write Rules for menu bar items

Quote Reply
Re-write Rules for menu bar items
Wondering if there is/are re-write rule(s) to put in .htaccess to show the following link:
http://www.mydomain.com/modify.cgi
instead of
http://www.mydomain.com/cgi-bin/links/modify.cgi

Same for "jump", "user", "add", "search","newsletter" ...etc.

Site is running in dynamic... but wants it to look static to people and search engines:

I have the following .htaccess so far.

Code:
RewriteEngine On
RewriteRule (.*)\.css $1.css [L]
RewriteRule ^images/(.*) images/$1 [L]
RewriteRule ^AddImages/(.*) AddImages/$1 [L]
RewriteRule ^Images/(.*) Images/$1 [L]

# Page Builder Pages
RewriteRule ^corp/(.*).php /cgi-bin/links/page.cgi?page=$1 [L]

# All other pages
RewriteRule ^info/(.*) /cgi-bin/links/page.cgi?p=$1 [L]
RewriteRule ^(.*).php /cgi-bin/links/page.cgi?g=$1.php [L]
RewriteRule ^/?$ /cgi-bin/links/page.cgi [L]
RewriteRule ^$ /cgi-bin/links/page.cgi [L]


Thank you again...
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Hi,

You could try:
Code:
RewriteRule ^(.*).cgi$ /cgi-bin/links/$1.cgi [L]

This 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!
Quote Reply
Re: [Andy] Re-write Rules for menu bar items In reply to
That caused a "500 Internal Server Error" (blank page or error)... ??? any idea why!!

thank you..
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Hi,

Please try this:

RewriteRule ^([a-z]+).cgi$ /cgi-bin/links/$1.cgi [L]

I think the other one was trying to match too much :)

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] Re-write Rules for menu bar items In reply to
Ummmm!! ... it's weired!! I still see the modify, add, search, newsletter the good same old way... means this rule did not really effect anything.
Do I need to change the way I am linking to them? but that should not be the case since it is a packaged software..
I put the new rule right after images...

All categories, sub categories work fine with my current .htaccess (shown below) accept this issue with modify, add, ...etc.

thank again
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Hi,

That rewrite rule will only affect the way you can access the URL =)

For example:

http://www.yourdomain.com/cgi-bin/links/add.cgi
...and:
http://www.yourdomain.com/add.cgi

...should both work now.

If they do, then you just need to update the links found in include_common_header.html I believe (can't remember exactly, but its definatly one of the include_*.html tempaltes <G>)

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] Re-write Rules for menu bar items In reply to
You are right Andy... now if I type: http://www.yourdomain.com/add.cgi
it takes me to the
http://www.yourdomain.com/cgi-bin/links/add.cgi?s=82c0348c4972d0f234234b46289436fa6bc;d=1

But I thought I do not need to change the way I am running links (change links in header) and other places!!!
the other rules that I have did not require me to change how I link to categories/subcateogires...etc.

So what is the purpose of using rewrite if I need to change the way I am linking to menu options..
Am I understanding it wrong... or do I need to change the way I am linking things... to call them..

Thank you...
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Hi,

Erm, of course it won't do it on its own - as its hardcoded with:

<%config.db_cgi_url%>/script.cgi

....so you need to change it to:

/script.cgi

I'm not really sure why you are trying to do this anyway?

Quote:
But I thought I do not need to change the way I am running links (change links in header) and other places!!!
the other rules that I have did not require me to change how I link to categories/subcateogires...etc.

Yup, thats cos they are STATIC looking files - the .cgi scripts are MEAN'T to be in the /cgi-bin/xx/ folder, not in the root of the domain Wink

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] Re-write Rules for menu bar items In reply to
aaaa. ... got you now!... so I do not have to change the menu links for those cgi scripts inside the cgi-bin directory.
My concern was to see a dynamic mode links when whole site appears to look static...
means if you navigate through the categories, then everything looks static, but when you try click add.cgi and login to add a link, then the link appears like this:
http://www.yourdomain.com/cgi-bin/links/add.cgi?s=82c0348c4972d0f234234b46289436fa6bc;d=1
my concern was that this look a dynamic link so... the user would be stuck in a dynamic mode and can not exit from it... with long URLs ...link/page.cgi?g=20;d=1 ...etc.. !!
So curious.. why categories/subcategories appear as static links even I did not change the way I am linking to them ... and they call page.cgi script inside the cgi-bin directory!!... while not the add, modify, user scripts even they call similar scripts inside the cgi-bin directory!!

thanks much..
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Hi,

Assuming you don't have hidden things like:'

<input type="hidden" name="d" value="1" />

...and you don't have:

d=1

...in your URLs, then nothing should go to dynamic mode :)

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] Re-write Rules for menu bar items In reply to
You are soo right Andy... I am appending "d=1" to the end of many URLs to force the dynamic mode... so I should remove this d=1 value since I did go ahead and deleted all static pages and all page builder pages to insure that all calls are passed in dynamically... otherwise, and empty page is show....

thanks soo much Andy...
Mark
Quote Reply
Re: [Andy] Re-write Rules for menu bar items In reply to
Thank you Andy...

Somehow, I am losing the user session "s=ksahkjhsfkjhsfoiu2o520u .." whhen the user logs in and navigate through the site...
Somehow... I think there is no rule in the .htaccess to cover the session senario when the user logs in and navigate through the site...
For example if user clicks on Login/Register, he will she be logged to the system and LINKS tells them you are logged in... however, if you click on any other link... the Login/Register still showing the URL shows http://www.mydomain.com/2/5/3/index.php (means no "s" value presented to indicated the user is logged in)...

Here is now my latest .htaccess file :
Code:
RewriteEngine On
###RewriteRule (.*)\.php $1.php [L]
RewriteRule (.*)\.css $1.css [L]
RewriteRule ^Images/(.*) Images/$1 [L]
RewriteRule ^images/(.*) images/$1 [L]
RewriteRule ^AddImages/(.*) AddImages/$1 [L]
RewriteRule ^banners/(.*) /banners/$1 [L]
RewriteRule ^static/(.*) static/$1 [L]
RewriteRule ^ads/(.*) ads/$1 [L]
# stuff so you can call custom templates via yoursite.com/g-template_name.html
RewriteRule ^g-(.*).html? /cgi-bin/links/page.cgi?p=$1 [L]
RewriteRule ^g-(.*)/? /cgi-bin/links/page.cgi?p=$1 [L]
# more page rewrite rule
RewriteRule ^([0-9/]+)/next([0-9]+)\.php$ /cgi-bin/links/page.cgi?g=$1/next$2.php [L]
RewriteRule /([0-9/]+)\.php$ /cgi-bin/links/page.cgi?g=$1/index.php [L]
RewriteRule /([0-9/]+)/next([0-9]+)\.php$ /cgi-bin/links/page.cgi?g=$1/next$2.php [L]

# detailed pages rewrite
RewriteRule ^Detailed/([0-9]+)\.php$ /cgi-bin/links/page.cgi?g=Detailed/$1.php [L]
# New, Pop, Ratings etc rewrite rules
RewriteRule ^New/?$ /cgi-bin/links/page.cgi?g=New [L]
RewriteRule ^Ratings/?$ /cgi-bin/links/page.cgi?g=Ratings [L]
RewriteRule ^Cool/?$ /cgi-bin/links/page.cgi?g=Cool [L]
# add, modify, search, subscribe, jump, user, and a generic rule to catch thre rest
RewriteRule ^([a-z]+).cgi$ /cgi-bin/links/$1.cgi [L]

RewriteRule ^corp/(.*).php /cgi-bin/links/page.cgi?page=$1 [L]
RewriteRule ^info/(.*) /cgi-bin/page.cgi?p=$1 [L]
RewriteRule ^(.*).php /cgi-bin/links/page.cgi?g=$1.php [L]
RewriteRule ^/?$ /cgi-bin/links/page.cgi [L]
RewriteRule ^$ /cgi-bin/links/page.cgi [L]

# perl links
RewriteRule ^(contact_us)(\.pl/)?$ /cgi-bin/links/contact_us.pl [L]


I think I am missing some rule to cover the user logs in/out...

thank you always for your help...
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Why dont' you just use cookies instead of sessions? Tongue

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] Re-write Rules for menu bar items In reply to
Well! seems the sessions is more secure as some users block cookies.. etc...
But I have few complicated custom mods and DB changes that were already using sessions... so I really can not migrate from it at this time...

Thank you..
Mark
Quote Reply
Re: [Mark2] Re-write Rules for menu bar items In reply to
Hi,

I'm afraid I don't really use session IDs, so havn't got any experience with passing them around via mod_rewrite really (it shouldn't be too hard, but I don't really wanna spend ages trying to work out a solution, as it could take a little while Tongue)

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] Re-write Rules for menu bar items In reply to
Thanks much Andy... you always been a very good help to all...
Let me try to create a new thread in the forum, maybe someone has an idea about...

best regards..
Mark