Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder DjDanHayden's Avatar
    Join Date
    Nov 2008
    Location
    Ireland
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Macintosh New mod rewrite ?

    Hi all,

    At the moment i have:

    Code:
    RewriteRule arena/(.*)$ game.php?game=$1
    Which rewrites .com/game.php?game=34 to .com/arena/MW2


    But im looking to edit this so i can add two more paths on front like this:

    Code:
    .com/platform/360/arena/mw3
    Those two pats, the first one is always /platform/ and the second one can change to anything depending on the link.

    Cany anyone help ??

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This wording is backwards: Which rewrites .com/game.php?game=34 to .com/arena/MW2. Its the other way around, the path /arena/mw2 is mapped to /game.php?game=mw2.

    You don't need to do a thing. The rule you have will still match the MW3 as your rule specifies it must end in /arena/(.*) which it does. You only need to alter the pattern if you need to capture which platform it is on.

  • Users who have thanked Fou-Lu for this post:

    DjDanHayden (09-12-2012)

  • #3
    New Coder DjDanHayden's Avatar
    Join Date
    Nov 2008
    Location
    Ireland
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    This wording is backwards: Which rewrites .com/game.php?game=34 to .com/arena/MW2. Its the other way around, the path /arena/mw2 is mapped to /game.php?game=mw2.

    You don't need to do a thing. The rule you have will still match the MW3 as your rule specifies it must end in /arena/(.*) which it does. You only need to alter the pattern if you need to capture which platform it is on.
    When i go to /platform/360/arena/mw3

    it just takes me to the platform.php file not the game.php (arena) file

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Since you haven't accessed a specific page, and you doesn't map to an index, that would tell me you have more rules in place overriding this rule.

  • #5
    New Coder DjDanHayden's Avatar
    Join Date
    Nov 2008
    Location
    Ireland
    Posts
    55
    Thanks
    18
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    Since you haven't accessed a specific page, and you doesn't map to an index, that would tell me you have more rules in place overriding this rule.


    Options +SymLinksIfOwnerMatch

    RewriteEngine on
    RewriteRule ^user/(.*)$ user.php?id=$1
    RewriteRule ^platform/(.*)$ platform.php?platform=$1
    RewriteRule ^arena/(.*)$ game.php?game=$1

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    And that's correct. Your platform rule matches your input prior to your arena check.
    You can either refine the rulesets, or you can move the check for arena up and flag it last with [L]

    Edit:
    Wait, your rules have changed. You'll need to write a more refined rule if you plan on adding a starts with to the pattern.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •