Gossamer Forum
Home : Products : Gossamer Links : Discussions :

question about Rewrite Rule

Quote Reply
question about Rewrite Rule
Can someone tell me the secret how I can write a Rewrite Rule for link with tow values?
Example- I have a link look like product.cgi?Item=54&Page=5
I success to write a Rewrite Rule for the Item=54but I don’t success to write Rewrite Rule for the next pages.
Is there a way to write a Rewrite Rule for more then one values?
Quote Reply
Re: [nir] question about Rewrite Rule In reply to
I'd use something like;

domain.com/products/item54/more2/index.html

RewriteRule ^products/item([0-9]+)/more([0-9]+)/index.html /cgi-bin/products.cgi?Item=$1&Page=$2

...or similar 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] question about Rewrite Rule In reply to
Thanks, work grate
Quote Reply
Re: [Andy] question about Rewrite Rule In reply to
Is it possible to have all my rewrite rules in one .htaccess file in my root path?

I found, that I have to create some .htaccess files is some specific directories, to get them work.
Any experience about this?

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...
Quote Reply
Re: [webmaster33] question about Rewrite Rule In reply to
Hi,

It all depends on your setup.

For example, with the destination path, you sometimes have to use a full path, rather than relative.

i.e;

cgi-bin/page.cgi?g=$1
/cgi-bin/page.cgi?g=$1
/full/path/to/cgi-bin/page.cgi?g=$1

..and similarly for the rules themselves;

RewriteRule ^pages/?$ - some servers
RewriteRule ^/pages/?$ - other servers
RewriteRule pages/?$ - some don't even let you use ^ at the beginning, if you want a match

The best way to do it (if you have access), is to use the httpd.conf file to put these rules in (or local .conf file, if you have access). Pugdog is obcesed with doing this on our servers <G>

I'm not sure if the above will actually help .. or is just babble. I'm hoping it'll help at least a little bit =)

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] question about Rewrite Rule In reply to
Thanks for the answer!

However, you didn't really answer the question, if I can solve all rewrites from one .htaccess file in root dir...


Quote:
The best way to do it (if you have access), is to use the httpd.conf file to put these rules in (or local .conf file, if you have access). Pugdog is obcesed with doing this on our servers <G>
On my local test server this is not a problem, but on the hosted virtual shared server I rent, this is not possible, as I have no access to httpd.conf. So I have to solve using .htaccess.



Additionally it seems now to have problems with getting work even a minimal rewrite rule, and I don't really find it why...
Using a test rule:
Quote:
RewriteEngine on
RewriteRule /faq http://www.aaaaaaa.com/ [R]
or
RewriteRule .*faq.* http://www.aaaaaaa.com/ [R]

I get logged this into rewrite_log.txt:
Quote:
(2) init rewrite engine with requested uri /faq
(1) pass through /faq

So it seems, rewrite engine is initiated, but doesn't seem to match it. Strange.
Also rewriteloglevel 9 is set.

In error_log.txt:
Quote:
File does not exist: C:/Work/site/faq

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...
Quote Reply
Re: [webmaster33] question about Rewrite Rule In reply to
So what does your .htaccess file look like?

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] question about Rewrite Rule In reply to
I showed already:
Quote:
RewriteEngine on
RewriteRule /faq http://www.aaaaaaa.com/ [R]
or
RewriteRule .*faq.* http://www.aaaaaaa.com/ [R]
Both gives same result for "http://site/faq" URL, as showed in previous post.

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...
Quote Reply
Re: [Andy] question about Rewrite Rule In reply to
Any idea about this rewrite problem?

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...
Quote Reply
Re: [webmaster33] question about Rewrite Rule In reply to
Hi,

Afraid not :(

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: [webmaster33] question about Rewrite Rule In reply to
Are you running under windows?


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] question about Rewrite Rule In reply to
Development platform -> Windows
Deploy platform -> Unix

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...
Quote Reply
Re: [webmaster33] question about Rewrite Rule In reply to
Here's is web site that helps generate rewrites

http://www.webmaster-toolkit.com/...rule-generator.shtml

You might find it useful
CCUnet
my Christian web
Quote Reply
Re: [ccunet] question about Rewrite Rule In reply to
Unfortunately, this was not useful.
Thanks anyway!

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...