Page 1 of 1

reguller expression question

Posted: Tue Feb 13, 2007 6:45 am
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,

Posted: Tue Feb 13, 2007 7:41 am
by Chris Corbyn

Code: Select all

RewriteRule ^([a-zA-Z0-9]+)_tickets.html  $1.php [nc]

Posted: Tue Feb 13, 2007 10:25 am
by Kieran Huggins

Code: Select all

RewriteRule ^([a-zA-Z0-9_]+)_tickets.html  $1.php [nc]
otherwise it won't match example 2

Posted: Thu Apr 26, 2007 2:48 am
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