Josh Posted April 6, 2023 Posted April 6, 2023 I am using this .ntaccess rewrite rule to prettify the documentation URLs: RewriteRule "^learn/(.+)$" "learn.php?page=$1" This makes it so the URL "https://www.ultraengine.com/learn/Entity" gets treated as "https://www.ultraengine.com/learn?page=Entity". However, if I have trailing arguments like "?lang=lua" they get omitted from the redirected URL. How can I add those into the rewrite rule? I want to use a URL like this: https://www.ultraengine.com/learn/Entity?lang=lua Quote Let's build cool stuff and have fun.
Josh Posted April 6, 2023 Author Posted April 6, 2023 This works: RewriteCond %{QUERY_STRING} ^lang=lua$ RewriteRule "^learn/(.+)$" "learn.php?page=$1&lang=lua" RewriteCond %{QUERY_STRING} ^lang=cs RewriteRule "^learn/(.+)$" "learn.php?page=$1&lang=cs" RewriteCond %{QUERY_STRING} ^lang=cpp RewriteRule "^learn/(.+)$" "learn.php?page=$1&lang=cpp" RewriteRule "^learn/(.+)$" "learn.php?page=$1" Quote Let's build cool stuff and have fun.
Josh Posted April 6, 2023 Author Posted April 6, 2023 Example: https://www.ultraengine.com/learn/LoadMaterial?lang=lua Quote Let's build cool stuff and have fun.
Solution IceBurger Posted April 6, 2023 Solution Posted April 6, 2023 You could instead use the QSA flag, like this: RewriteRule "^learn/(.+)$" "learn.php?page=$1" [QSA] 1 Quote i now hate love C++ Beeeeeeeeeeeeeep~~This is a test of the emergency signature system~~Beeeeeeeeeeeeeep RX 6800XT | i5-13600KF | 32GB DDR5 | 1440p is perfect
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.