.htaccess RewriteRule



  • We need to turn that reference.

    index.php?route=module/brainyfilter/filter&bfilter=f1:1&page=2
    

    Here's the thing:

    /man/?page=2
    

    or

    /man/2
    

    In this case, f1:1 is man

    And something else. Reference:

    index.php?route=module/brainyfilter/filter&bfilter=m0:8,57;f1:1;&page=2
    

    f1:1 as in the past, the example is replaced by man, and this is the design

    m0:8,57;
    

    shall be divided by m0:[id],[id] Number of id from 0 to infinity

    I'd like to turn a second example into something like that.

    man/[id]/[id]/?page=2
    

    or

    man/[id]/[id]/2
    


  • The first task can be accomplished as follows:

    RewriteEngine On
    RewriteBase /
    

    RewriteCond %{QUERY_STRING} ^route=module/brainyfilter/filter&bfilter=f1:1&page=(.*)
    RewriteRule ^index.php$ /man/%1? [R=301,L]

    There's a redirection to the species. /man/2♪ To redirect the species' addresses. /man/?page=2 The last line should be changed:

    RewriteRule ^index.php$ /man/?page=%1 [R=301,L]

    The second task is harder. I'm not sure she can be solved by means. mod_rewrite

    UPDATE 1

    As the comments made clear, the challenge needs to be reversed. This is the first option:

    RewriteEngine On
    RewriteBase /

    RewriteRule ^man/(.+) index.php?route=module/brainyfilter/filter&bfilter=f1:1&page=$1 [L,R=302]

    RewriteCond %{QUERY_STRING} ^page=(.+)$
    RewriteRule .* index.php?route=module/brainyfilter/filter&bfilter=f1:1&page=%1 [L,R=302]

    The second option, too, is not solved with the help of. mod_rewrite

    UPDATE 2

    I'm wrong! The second option, too. It's complicated, but I can. This is an example of a file that makes all the necessary redirections of the type addresses. /man/id1/.../idN:

    RewriteEngine On
    RewriteBase /

    RewriteCond %{QUERY_STRING} !page=
    RewriteRule ^man/(.*?)([^/]+)$ /man/$1?route=module/brainyfilter/filter&bfilter=f1:1&page=$2 [R=303,L]

    RewriteCond %{QUERY_STRING} &bfilter=f1:1&page=(.+)
    RewriteRule ^man/([^/]+)(.*) /man$2?route=module/brainyfilter/filter&bfilter=m0:$1;f1:1&page=%1 [R=303,L,NE]

    RewriteCond %{QUERY_STRING} &bfilter=m0:(.+);f1:1&page=(.+)
    RewriteRule ^man/([^/]+)(.*) /man$2?route=module/brainyfilter/filter&bfilter=m0:%1,$1;f1:1&page=%2 [R=303,L,NE]




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2