mod_rewrite - ReWriteMap - Based on keywords

mod_rewrite - ReWriteMap - Based on keywords

Post by superdave.. » Sat, 26 Oct 2002 20:55:29



I am attempting to make a rewrite map that does the following

1. Based on Refering URL KEYWORD - Not the whole URL
2. Map words from a flat text file and redirect to http:// or local
test file
3. If keyword is not found(matched) then no rewriting is done.

-------------------------------------

Example scenario:

Person clicks link on referring page:
http://www.veryComputer.com/

This links to my page:   http://www.veryComputer.com/

Hits my .htaccess (or httpd.conf virtualhost)

in my  keymap file:

somefunction    http://www.veryComputer.com/

----------------------------------------

I tried this, but it does not function:

Rewri*gine on
RewriteMap keymap txt:/www/keyword.txt
RewriteRule ^/([^/]+)(.*)$ ${keymap:$1}

keyword.txt is there, apache starts with no errors.

keyword.txt contains:
somefunction    http://www.veryComputer.com/

Where am I going wrong?   Am I making this too complicated?

 
 
 

1. mod_rewrite - ReWriteMap - Based on keywords

I am attempting to make a rewrite map that does the following

1. Based on Refering URL KEYWORD - Not the whole URL
2. Map words from a flat text file and redirect to http:// or local
test file
3. If keyword is not found(matched) then no rewriting is done.

-------------------------------------

Example scenario:

Person clicks link on referring page:
http://search.apache.org/search.cgi?query=somefunction&othervariable=...

This links to my page:   http://www.somecoolwebsite.com

Hits my .htaccess (or httpd.conf virtualhost)

in my  keymap file:

somefunction    http://testdomain.com/a-page-about-the-function.html

----------------------------------------

I tried this, but it does not function:

RewriteEngine on
RewriteMap keymap txt:/www/keyword.txt
RewriteRule ^/([^/]+)(.*)$ ${keymap:$1}

keyword.txt is there, apache starts with no errors.

keyword.txt contains:
somefunction    http://www.test-domain.com/search.cgi?somefunction

Where am I going wrong?   Am I making this too complicated?

2. Solaris x86 coredumping

3. Help with mod_rewrite and rewritemap

4. Linux-2.0, Java & Triton

5. mod_rewrite: RewriteMap & HTTP_USER_AGENT

6. Couldn't load XKB keymap

7. mod_rewrite and rewritemap efficiency

8. Too much swap space??

9. mod_rewrite RewriteMap lock error

10. Extracting from a string based on keywords

11. Mod_rewrite and dynamic content based on HTTP:Accept

12. using mod_rewrite to redirect based on query-string

13. mod_rewrite and name-based virtual hosts