Adding URL How can I edit this URL again to add an additional variable variable? I have tried some etimes, but I always get a 500 internal server error!
I have added comments to show what I am trying to achieve.
# / view php? User = h5k6 and page = 1 externally on / h5k6 / 1 # can be on the page some time variable variable will not exist, so it should only show / h5k6 rewrite% {THE_REQUEST} ^ GET \ / view.php rewrite% { QUERY_STRING} ^ ([^ & Amp ;; * * & amp;) * Users = ([^ & amp;; +) & amp; * See $ rewriter ^ .php $ /% 2? [L, R = 301] Internal / /. View.php? T = h5k6 & amp; page = 1 reViTrial ^ ([0- 9a-zed +) + $ view.php? T = Internally for $ 1 [L]
Thanks for any help
The problem with URI query logic is that they can appear in any order, with two arguments, you have two permutations ( A before A and B A before ). But the more logic you want to remove more permutations with you.
This means that you should put the logic in the correct order so that you can do it at one time:
Rewindkind% {THE_REQUEST} ^ GET \ /view.php Reverted% {QUERY_STRING} ^ (([^ & amp;; * & amp;) *) (page = [^ & amp;; +] & amp; ([^ & amp;;]. *)? $ Rewrite% 3 and% 1% 4 ^ (([and amp;] * and) *) (user = [^ & amp;] +) & amp;? ([^ & Amp;. *)? $ RewriteCond% 3 and% 1% 4 ^ users = ([^ & amp;; + +)) and page = ([^ & amp;; +) & amp;? ([^ & Amp;]. *)? $ RewriteRule ^ See \ .php $ /% 1 /% 2?% 3 [L, R = 301]
The first condition examines the request line as your rule Second condition < Em> page logic and puts it in the beginning of the query string. The third position is similar to the user argument so that the order is always done: first user , second page . Then we assume both logic at one time using the fourth condition so that they can use them in the RewriteRule
substitution, the rest of the query is replaced by the replacement URL (which is shown on % 3
), But you can leave if you wish.
As you see, extracting more logic that you want, it becomes more complex. And it's easy to do that with languages like PHP that are more powerful than mod_rewrite.
Comments
Post a Comment