php - htaccess rewriterule can do this? -
a php script generate virtual pages based on keyword array, using template master file. it's rule:
rewriterule ^([+a-za-z0-9]+)/([+a-za-z0-9]+)\_service.html$ /master-one.php?city=$1 [l] i want add master file read based on secondary keyword array. tried copying rule, changes /master-one.php /master=two.php, results in pages being generated keyword, displays master-one.php content.
how solve riddle?
sure. can have more 1 rewriterule. need have different patterns , should ordered desired priority.
simply avoid overly generic placeholders. might like:
rewriterule ^(boston|washington|whatever)/(\w+?)_service.html$ /one.php?c=$1 [l] rewriterule ^(paris|london|amsterdam)/(\w+?)_service.html$ /two.php?c=$1 [l] rewriterule ^(\w+)/(else|and|whatever)_service.html$ /else.php?xyz=$2 [l] the \w+? matches alphanumeric characters. alternative lists (x|y|z) whatever keywords each rule should match.
neither rule can keywords each of template/master files can handle. you'll therefore have manually craft alternative lists. (there automatisms [rewritemap], that's impossible answer without further details - you've been asked for...)
see also: reference: mod_rewrite, url rewriting , "pretty links" explained
Comments
Post a Comment