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

i Don't get the mod_rewrite

Quote Reply
i Don't get the mod_rewrite
I have static pages for all my categories, but I want them to be dynamic so when I add links in the admin it will show without me building, I know I have to use the mod_rewrite to get that but how do I do it
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
Hopefully this post will help;

http://www.gossamer-threads.com/...i?post=269599#269599

Basically, you need to make a .htaccess file, and upload it to your appropriate folder. The mod_rewrite code I provided in the above URL **MAY** work as-is ... but more than likely, it will require a little tweaking, to get it working on your site right.

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] i Don't get the mod_rewrite In reply to
Thanks Andy,
I just add the .htaccess file with this in it

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]

and I put it in the folder where all the pages are created

I just added a link but it is not showing on the category page unless I build it, how do I avoid this
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
Try adding this;

Code:
RewriteRule ^/?$ /cgi-bin/page.cgi [L]

...just before;

Code:
RewriteRule ^$ /cgi-bin/page.cgi [L]

Probably a better way... but that 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] i Don't get the mod_rewrite In reply to
Hi Andy,
Still not working,
When I add a new link it always appears in the globals like Recently_Modified links without me building but does not show up in my static pages for the categories unless I build all


Here is what I currently i have in my .htaccess file

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]
RewriteRule ^$ /cgi-bin/page.cgi [L]

Last edited by:

Abusaki: Nov 4, 2004, 11:19 AM
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
Shoot over FTP details, and I'll take a look for you quickly Angelic

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] i Don't get the mod_rewrite In reply to
Thank Andy,
Just sent you an email with the details
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
Should all be fixed up now :)

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] i Don't get the mod_rewrite In reply to
have solved ????


Thanks in Advance
Bye From Italy
Quote Reply
Re: [fabio] i Don't get the mod_rewrite In reply to
In Reply To:
have solved ????

Yup :)

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] i Don't get the mod_rewrite In reply to
Hi Andy,
How do I create new pages like about us or privacy policy, because when I try to upload a file by FTP and go to my browser to check it, it tells me page does not exist
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
RewriteRule ^p/(.*)\.html /cgi-bin/page.cgi?p=$1

...should be that easy :)

Then call with;

http://www.yourdomain.com/p/page_name.html .. which would equate to http://www.yourdomain.com/cgi-bin/page.cgi?p=page_name

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] i Don't get the mod_rewrite In reply to
Thank Andy,
It works but as this

http://www.yourdomain.com/p/page_name

not with the .html like this

http://www.yourdomain.com/p/page_name.html

because that gives me an error like this

A fatal error has occured:
Invalid SiteHTML method: 'site_html_aboutus.html'. at /home/xxxxxxxx/xxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx/cgi-bin/admin/Links/SiteHTML.pm line 241.Please enable debugging in setup for more details.

Last edited by:

Abusaki: Dec 12, 2004, 10:37 AM
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
mmm.. you sure?

Try;

RewriteRule ^p/(.*).html /cgi-bin/page.cgi?p=$1

As far as I can see, $1 should just hold the filename... which is all you need to pass along (or you get the error about the function not existing).

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] i Don't get the mod_rewrite In reply to
Hi Andy,
How do I have my links sorted by Add Date so only the new links appear on top,
it looks like it is being sorted out by Title instead off Add Date
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
You would need to change the build_category_sort option in Setup > Build Options. Add something like this to the BEGINING;

Add_Date ASC

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] i Don't get the mod_rewrite In reply to
Thanks Andy,
It worked.

I just noticed all the font sizes in my LinksSQl Admin has changed , looks bigger
and it is happening anytime I vist this forum or the ultranerds forum, my fonts look bigger than usual, how do I change that
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
No problem. Your text issue is probably down to IE. Try clicking View > Text Size > Medium

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] i Don't get the mod_rewrite In reply to
Looks better now
Quote Reply
Re: [Abusaki] i Don't get the mod_rewrite In reply to
I moved all my pages to a new domain, how do I create a permanent redirect for a specific pages to the new domain.
I m no longer using Cpanel as my control panel so I can't redirect, is there any way i can put a code in the each pages to redirect?
Quote Reply
Re: [Andy] i Don't get the mod_rewrite In reply to
I've inserted your code exactly as is in my .htaccess file and modified the extension to .php instead of .html as I use .php as the extention of the built pages (through lqsl setup).
Everything seems to work Ok, however, since I use also two additional parameters in the URL, then how would I add them to the mod rewrite code?
the additional parameters are:
Code:
&lang=ru&t=russian

lang and t are preserved parameters:
so the code that I have in .htaccess looks something like this below... but can u please review it see where should I do the changes... and whether I am refering to images and css correctly ..?
thanks much
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/linkssql/page.cgi?g=$1 [L]
RewriteRule ^info/(.*) /cgi-bin/linkssql/page.cgi?p=$1 [L]
RewriteRule ^(.*).php /cgi-bin/linkssql/page.cgi?g=$1.php [L]

RewriteRule ^/?$ /cgi-bin/page.cgi [L]
RewriteRule ^$ /cgi-bin/linkssql/page.cgi [L]
Quote Reply
Re: [Mark2] i Don't get the mod_rewrite In reply to
Hi,

Quote:
since I use also two additional parameters in the URL, then how would I add them to the mod rewrite code?
the additional parameters are:


It depends really :)

You could modify it so you use a URL like;

http://www.yourdomain.com/links/englsh/en/Category_Name/
...etc,
and then change the rewrite rules to;

Code:
RewriteEngine On
RewriteRule (.*)\.css $1.css [L]
RewriteRule ^images/(.*) images/$1 [L]
RewriteRule ^AddImages/(.*) AddImages/$1 [L]
RewriteRule ^Images/(.*) Images/$1 [L]
RewriteRule ^([english|russian|french])/([en|ru|fr])/p/(.*) /cgi-bin/linkssql/page.cgi?g=$3;lang=$2;t=$1 [L]
RewriteRule ^([english|russian|french])/([en|ru|fr])/info/(.*) /cgi-bin/linkssql/page.cgi?p=$3;lang=$2;t=$1 [L]
RewriteRule ^([english|russian|french])/([en|ru|fr])/(.*).php /cgi-bin/linkssql/page.cgi?g=$3.php;lang=$2;t=$1 [L]
RewriteRule ^([english|russian|french])/([en|ru|fr])/?$ /cgi-bin/page.cgi?lang=$2;t=$1 [L]
RewriteRule ^([english|russian|french])/([en|ru|fr])/$ /cgi-bin/linkssql/page.cgi?lang=$2;t=$1 [L]

as well as;

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



Totally untested, but will hopefully get you on the right trail :)

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] i Don't get the mod_rewrite In reply to
I have two languages (en, ru) only, and two templates (english, russian),
and I am calling them from the following URL:
...page.cgi?d=1&lang=ru&t=russian
or
...page.cgi?d=1&lang=en&t=english

and I feel something wrong here in g=$3...etc... I do not know really what it means...
I hope you can correct this script for me....
truely appricaitated...
Mark
Code:

RewriteEngine On
RewriteRule (.*)\.css $1.css [L]
RewriteRule ^images/(.*) images/$1 [L]
RewriteRule ^AddImages/(.*) AddImages/$1 [L]
RewriteRule ^Images/(.*) Images/$1 [L]
RewriteRule ^([english|russian])/([en|ru])/p/(.*) /cgi-bin/linkssql/page.cgi?g=$3;lang=$2;t=$1 [L]
RewriteRule ^([english|russian])/([en|ru])/info/(.*) /cgi-bin/linkssql/page.cgi?p=$3;lang=$2;t=$1 [L]
RewriteRule ^([english|russian])/([en|ru])/(.*).php /cgi-bin/linkssql/page.cgi?g=$3.php;lang=$2;t=$1 [L]
RewriteRule ^([english|russian])/([en|ru])/?$ /cgi-bin/page.cgi?lang=$2;t=$1 [L]
RewriteRule ^([english|russian])/([en|ru])/$ /cgi-bin/linkssql/page.cgi?lang=$2;t=$1 [L]