reguller expression question

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

reguller expression question

Post by itsmani1 »

I want to throw
/abc_tickets.html to abc.php
/mnm_kk_tickets.html to mnm_kk.php

now one thing is common in this that every thing is ending with _tickets.html and will be throws to respective pages.

currently i am doing:

Code: Select all

RewriteRule ^abc_tickets.html abc.php [nc]
RewriteRule ^mnm_kk_tickets.html mnm_kk.php [nc]
but this is not a good way and i want to improve this one.

Thank You,
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

RewriteRule ^([a-zA-Z0-9]+)_tickets.html  $1.php [nc]
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Code: Select all

RewriteRule ^([a-zA-Z0-9_]+)_tickets.html  $1.php [nc]
otherwise it won't match example 2
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Well there is problem with this rule

Code: Select all

RewriteRule ^([a-zA-Z0-9_]+)_tickets.html  $1.php [nc]
i don't think this will be working if i want to transer las_vegas_tickets.html to lasvegas.php
is there any way so it can work?


thank you
Post Reply