[英]apache rewritemap not working URL does not translate
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 我的httpd.conf中包含以下内容,并重新启动了apache
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 根目录中的.htaccess具有以下条目
RewriteCond ${ErrorMap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*)$ ${ErrorMap:$1|$1} [R=301]
Edit: Just posting my current .htaccess file contents for reference 编辑:只是发布我当前的.htaccess文件内容以供参考
<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>
When you call the map: 致电地图时:
${ErrorMap:$1
The $1
is never going to have http://www.site.com/
in it. $1
永远不会包含http://www.site.com/
。 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/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.