I’m trying to use .htaccess but i’m a bit lost at this point. I was wondering how would you do
a rewriting for multiple pages.
RewriteRule ^your-order/$ /page1.php,page2.php,page3.php [L]
or should i just do this:
RewriteRule ^your-order/$ /page1.php [L]
RewriteRule ^your-order/$ /page2.php [L]
RewriteRule ^your-order/$ /page3.php [L]
also i was wondering if rewriterule would still execute if the page has a parameter:
URL: page1.php?test=hello
RewriteRule ^your-order/$ /page1.php [L]
I am assuming from your question about the query string params that you actually have the concept of the rewrites backward. The first expression is the submitted URL (pageN.php) and the second one is where it should be redirected or rewritten (your-order). In that case, you need only one rule.
Unless you need to take special action if a query string parameter is present (like go to a different page entirely), you don’t need to match the query string. Query strings are matched in separate
RewriteCondconditions rather than in theRewriteRule.If your pages are actually named with the number at the end (which I doubt), you could use this expression instead:
In either case, if you want the end user’s browser to be redirected to the your-order URL, rather than an internal and invisible rewrite, change
[L,QSA]to[L,R,QSA]