Gossamer Forum
Quote Reply
Mod_Rewwrite
Hi,

Does anyone know the best code to use to turn Dynamic Urls into Static ?


Thanks!
Quote Reply
Re: [rascal] Mod_Rewwrite In reply to
Hi,

I tend to use this kind of formatting:
Code:
RewriteEngine On

RewriteRule ^/?$ /cgi-bin/links/page.cgi?g=index.html [L]
RewriteRule ^index.html$ /cgi-bin/links/page.cgi?g=index.html [L]

# CSS/images/other page type rewrites, so they get shown, instead of page.cgi picking them up
RewriteRule (.*)\.css $1.css [L]
RewriteRule (.*)\.php $1.php [L]
RewriteRule ^images/(.*) images/$1 [L]

# stuff so you can call custom templates via yoursite.com/p/template_name.html
RewriteRule ^p/(.*)/? /cgi-bin/links/page.cgi?p=$1 [L]

# detailed pages rewrite
RewriteRule ^Detailed/([0-9]+)\.html$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule ^.*L([0-9]+)/(.*)\.html$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [L]
RewriteRule ^.*L([0-9]+)/?$ /cgi-bin/links/page.cgi?g=Detailed/$1.html [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]

# category page rewrite
RewriteRule ^(.*)/index\.html$ /cgi-bin/links/page.cgi?g=$1/index.html [L]

# more page rewrite rule
RewriteRule ^(.*)/more([0-9]+)\.html$ /cgi-bin/links/page.cgi?g=$1/more$2.html [L]


Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Mod_Rewwrite In reply to
Thanks for the codes Andy,

I tryed this:

RewriteRule ^New/?$ /cgi-bin/links/page.cgi?g=New [L]

and got requested URL not found when I click on a date on the new page.
Quote Reply
Re: [rascal] Mod_Rewwrite In reply to
Sorry, my mistake you need:

Code:
# New, Pop, Ratings etc rewrite rules
RewriteRule ^New/?$ /cgi-bin/links/page.cgi?g=New [L]
RewriteRule ^New/(.*)\.html?$ /cgi-bin/links/page.cgi?g=New/$1.html [L]
RewriteRule ^Ratings/?$ /cgi-bin/links/page.cgi?g=Ratings [L]
RewriteRule ^Cool/?$ /cgi-bin/links/page.cgi?g=Cool [L]

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Mod_Rewwrite In reply to
Thank you Andy,

I use the Pagebuilder Plugin how do you convert those URLS,

Example: http://www.mysite.com/site-map
Quote Reply
Re: [rascal] Mod_Rewwrite In reply to
Hi,

You would just need something like:

Code:
RewriteRule ^site-map$ /cgi-bin/links/page.cgi?page=sitemap [L]

...or:

Code:
RewriteRule ^sitemap.html$ /cgi-bin/links/page.cgi?page=sitemap [L]

It really depends on what you have the page named as in PageBuilder. The easiest way to test, is by just calling http://www.site.com/cgi-bin/links/page.cgi?page=xx

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Mod_Rewwrite In reply to
Thanks Andy, worked like a charm!

One last question if you would help!

Convert this:

http://www.mysite.com/cgi-bin/links/page.cgi?p=login_success

To this:

http://www.mysite.com/login_success
Quote Reply
Re: [rascal] Mod_Rewwrite In reply to
Hi,

No problem =)

That ones simple (but it would probably require tweaking else where in the script, so that it goes to the new URL =)

Code:
RewriteRule ^login_success$ /cgi-bin/links/page.cgi?p=login_success [L]

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates