match 'article' in url RewriteRule
        Posted  
        
            by daniel Crabbe
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by daniel Crabbe
        
        
        
        Published on 2010-05-28T11:33:07Z
        Indexed on 
            2010/05/28
            11:41 UTC
        
        
        Read the original article
        Hit count: 308
        
hello there.
building a site which has content for each section.
urls range from;
/work/
/work/print/
/work/print/folders etc.
however, at any point a user can click on an article so;
/work/article/1066
/work/print/article/1066
/work/print/folders/article/1066  
using .htaccess i need to detect when there is 'article' in the url and set some different variables.
RewriteRule ^([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-]+)/$ 
sets  index.php?level1=$1&level2=$2&level3=$3&level4=$4
but if 'article/([0-9-]+)' is in the url, say /work/print/article/1066 return index.php?level1=$1&level2=$2&articleID=1066
basically the amount of levels will always be different but i'd like to return those as needed. another example would /work/print/folder/archive/article/1066 return
index.php?level1=$1&level2=$2&level3=$3&level4=$4&articleID=1066
any help appreciated! Dan
© Stack Overflow or respective owner