Home > Mobile >  .htaccess rewrite specific page with backslash parameters
.htaccess rewrite specific page with backslash parameters

Time:10-26

Please helt - I need a rewriteRule for a specific page with backslash paramters like:

/page/parameter1/paramter2

Rewriterule to

/anotherpage/paramter1/paramter2

tried this but i did not work:

RewriteRule ^page/$ /anotherpage.php/$ [L]

CodePudding user response:

Converting my comment to answer so that solution is easy to find for future visitors.

You may use this rule:

RewriteRule ^page/(.*)$ /anotherpage/$1 [L,NC]

Note that we match any text after page/ into a capture group and use the back-reference of the capture group $1 in the target.

  • Related