.htaccess - htaccess redirect dynamic urls -


i trying write htaccess redirect, not working want to. current (working) htaccess redirects html pages 1 character index file as:

rewriterule ^([a-za-z0-9]).html$ index.php?letter=$1 

so a.html gets redirected index.php?letter=a need redirect page a.html?page=2 index.php?letter=a&page=2 want redirect url, leave dynamic part intact. of following return 404:

rewriterule ^([a-za-z0-9]).html?page=([0-9]+) index.php?letter=$1&page=$2  rewriterule ^([a-za-z0-9]).html?page=(.*) index.php?letter=$1&page=$2  rewritecond %{query_string} page=(.*) rewriterule ^([a-za-z0-9]).html(.*) index.php?letter=$1&page=%1 

i think i'm close, can't seem there :/ give me last push?

your rewriterule needs be

rewriterule ^([a-za-z0-9])\.html$ index.php?letter=$1 [qsa,nc,l] 

please, note url parameters not available matching within rewriterule. if need append url parameter can along [qsa] flag take care of appending original url parameters you.

please, note dot before html needs escaped \. well. [l] makes sure rewriting stops , no further rules (if below) applied.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -