0

I cannot get my rewrite map to work. I have read a lot of pages on this and yet can't figure out how.

I have the following in my httpd.conf and took an apache restart

RewriteMap ErrorMap txt:/usr/local/apache/conf/userdata/std/1/techencl/site.com/vb2xf.map

The rewrite map has the following entry (edited after the tip in the first reply)

corner/lock-unlock-140859.html http://www.site.com/com/ts/lock-unlock.70898/

The .htaccess in the root directory has the following entry

RewriteCond ${ErrorMap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*)$ ${ErrorMap:$1|$1} [R=301]

Edit: Just posting my current .htaccess file contents for reference

<IfModule mod_rewrite.c>
    RewriteEngine On

RewriteRule [^/]+/.+-([\d]+)/p([\d]+)/ showthread.php?t=$1&page=$2 [NC,L]
RewriteRule [^/]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]


Options +FollowSymlinks
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 

RewriteCond ${ErrorMap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*)$ ${ErrorMap:$1|$1} [R=301]
</IfModule>
Rahul
  • 51
  • 3

1 Answers1

0

When you call the map:

${ErrorMap:$1

The $1 is never going to have http://www.site.com/ in it. It will only have this part:

corner/lock-unlock-140859.html

That means in your map, you need to make it look like this:

corner/lock-unlock-140859.html http://www.site.com/com/ts/lock-unlock.70898/
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • I have tried it with the following but it still does not work. "_corner/lock-unlock-140859.html_" "_lock-unlock-140859_" – Rahul Jan 29 '14 at 02:29