match 'article' in url RewriteRule
- by daniel Crabbe
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