Current location: Hot Scripts Forums » Programming Languages » PHP » Apache mod rewrite regex problem


Apache mod rewrite regex problem

Reply
  #1 (permalink)  
Old 12-20-11, 03:23 PM
connector connector is offline
Newbie Coder
 
Join Date: Jul 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Post Apache mod rewrite regex problem

Hi
i have done a pagination class and i am getting some $_GET variables and use the class to paginate and return the appropriate data and pages. i need my urls to be :

http://mysite.com/teams/{team_name}/page/{page_number} e.g :
http://mysite.com/teams/chelsea/page/2

here is my regex :
RewriteRule ^teams/([^.]+)/page/([0-9]+)(/?)+$ group.php?name=$1&page=$2 [L]
i have tried this too :
RewriteRule ^/teams/([^.]+)/page/([0-9]+)(/?)+$ group.php?name=$1&page=$2 [L]
i have tried some other options like (.*) or (.*?) ...

unfortunately non of the above worked, i don't know what else i should try. i would appreciate any help!
Thanks
Reply With Quote
  #2 (permalink)  
Old 12-22-11, 07:06 AM
connector connector is offline
Newbie Coder
 
Join Date: Jul 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
hmm any suggestion?
Reply With Quote
  #3 (permalink)  
Old 12-22-11, 07:15 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 98
Thanks: 0
Thanked 9 Times in 9 Posts
post the original uri(index.php?something=whatever&something_else=el se)
Reply With Quote
  #4 (permalink)  
Old 12-22-11, 07:26 AM
connector connector is offline
Newbie Coder
 
Join Date: Jul 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
group.php?name=chelsea&page=2
Reply With Quote
  #5 (permalink)  
Old 12-22-11, 07:48 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 98
Thanks: 0
Thanked 9 Times in 9 Posts
eeerm that seems fine... are you sure you have allowed the apache to override the directory structure(configured php.ini)
Reply With Quote
  #6 (permalink)  
Old 12-22-11, 10:39 AM
connector connector is offline
Newbie Coder
 
Join Date: Jul 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by alxkls View Post
eeerm that seems fine... are you sure you have allowed the apache to override the directory structure(configured php.ini)
hmm seems not, what exactly is this?
well see, i have another rule which is:
RewriteRule ^teams/(.*)$ group.php?name=$1 [L]
and it works totally fine. but when that another variable is added things get changed.
tell me more about that directory structure please.
thanks
Reply With Quote
  #7 (permalink)  
Old 12-22-11, 12:45 PM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 98
Thanks: 0
Thanked 9 Times in 9 Posts
try
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule group/teams/(.*)/page/(.*)/ group.php?name=$1&page=$2
see if that works... as for the php.ini-i wrote something about it some time ago
Getting .htaccess to work | PHP F(n)

pretty much all you need in your case...
Reply With Quote
Reply

Bookmarks

Tags
apache, module_rewrite


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rewrite problem afox Web Servers 0 06-23-11 08:30 AM
HUNDREDS of apache services running ?! slows server down immensley! SlaveDriver Web Servers 0 11-02-08 09:29 AM
Mod Rewrite problem sod_atticus PHP 1 07-19-06 02:13 PM
mod rewrite problem gnznroses Perl 4 11-02-05 11:24 PM
Some mod rewrite help jasong PHP 4 01-02-05 01:04 AM


All times are GMT -5. The time now is 08:59 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.