Help with mod_rewrite and rewritemap

Help with mod_rewrite and rewritemap

Post by bern » Wed, 12 Sep 2001 17:58:28



My site has some filenames with 2 or more spaces.
Some search engines substitute them with some + but in this way their
request can't reach the pages.
I am trying to use mod_rewrite to change the request substituting the
filename with + with the filename with %20.
I am trying to use a rewrite map but I'm not able to make it work.
This is what I wrote in the httpd.conf:

Rewri*gine On
RewriteLog "/home/mhd/rewrite.log"
RewriteLogLevel 9
RewriteMap berno     txt:/home/mhd/map.txt
RewriteRule ^/home/mhd/prova/www.domain.it/htdocs/(.*)
/home/mhd/prova/www.domain.it/htdocs/${berno:$1|$1}

In the map I put only a trial substitution such as:
pippo+prova.html   pippo%20prova.html

The log gave me this report:

init rewrite engine with requested uri /default.ida
applying pattern '^/home/mhd/prova/www.domain.it/htdocs/(.*)' to uri
'/default.ida'
pass through /default.ida

What is my mistake ?

 
 
 

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. Unable to change data..

3. mod_rewrite: RewriteMap & HTTP_USER_AGENT

4. Xfree4.0 and Solarisx86 8.0

5. mod_rewrite and rewritemap efficiency

6. mail

7. mod_rewrite RewriteMap lock error

8. /dev/cua1: ioctl TIOCMGET fails after tcsendbreak

9. mod_rewrite - ReWriteMap - Based on keywords

10. rewriteMap in apache dies when mysql used..? help!

11. Help with RewriteMap, and Conditions

12. RewriteMap not allowed here (please help)

13. Matrox Mystique ands X.