Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-09-2012, 09:01 PM   PM User | #1
DjDanHayden
New Coder

 
DjDanHayden's Avatar
 
Join Date: Nov 2008
Location: Ireland
Posts: 43
Thanks: 16
Thanked 0 Times in 0 Posts
DjDanHayden is an unknown quantity at this point
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 ??
DjDanHayden is offline   Reply With Quote
Old 09-12-2012, 12:12 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
DjDanHayden (09-12-2012)
Old 09-12-2012, 06:19 PM   PM User | #3
DjDanHayden
New Coder

 
DjDanHayden's Avatar
 
Join Date: Nov 2008
Location: Ireland
Posts: 43
Thanks: 16
Thanked 0 Times in 0 Posts
DjDanHayden is an unknown quantity at this point
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
DjDanHayden is offline   Reply With Quote
Old 09-12-2012, 06:58 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 09-12-2012, 09:01 PM   PM User | #5
DjDanHayden
New Coder

 
DjDanHayden's Avatar
 
Join Date: Nov 2008
Location: Ireland
Posts: 43
Thanks: 16
Thanked 0 Times in 0 Posts
DjDanHayden is an unknown quantity at this point
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
DjDanHayden is offline   Reply With Quote
Old 09-12-2012, 09:43 PM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
.htaccess, clean, mod, rewrite

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:18 AM.


Advertisement
Log in to turn off these ads.