rewrite rule problem

#1
I am using the following rules :

RewriteRule ^([0-9]+)-([a-z]+)-([0-9]+)\.html$ http://subdomain\.maindomain\.com/process\.php?id=$1&ad=$3 [R=301,L]

RewriteRule ^([0-9]+)-([a-z]+)-([0-9]+)-([0-9]+)\.html$ http://subdomain\.maindomain\.com/process\.php?id=$1&ad=$3&page=$4 [R=301,L]

RewriteRule ^([0-9]+)-([a-zA-Z0-9-]+)-([0-9]+)-url\.html$ http://subdomain\.maindomain\.com/form\.php?id=$1&keyword=$2&url=$3 [R=301,L]

RewriteRule ^([0-9]+)-([a-zA-Z0-9-]+)-([0-9]+)-custom\.html$ http://subdomain\.maindomain\.com/form\.php?id=$1&keyword=$2&custom=$3 [R=301,L]


But none of them works. What am I doing wrong here ?
 

mistwang

LiteSpeed Staff
#2
Those are rules for .htaccess, will not work at vhost level. The difference is that at .htacess level, rewrite base are striped from URL before matching the URL with the rule, it does not happen at vhost level. You may need to add a leading "/" to regex pattern when used at vhost level. like

RewriteRule ^/([0-9]+)-([a-z]+)-([0-9]+)\.html$ http://subdomain\.maindomain\.com/process\.php?id=$1&ad=$3 [R=301,L]
 
Top