Jump to content

.htaccess rewrite rules?


Josh
 Share

Go to solution Solved by IceBurger,

Recommended Posts

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

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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"

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...