Helpful Information
 
 
Category: Regex Programming
Optional portion of Regular Expression

Hello all,

I am currently using the rollowing RewriteRule;


RewriteRule ^admin/news/edit/([0-9]+)/$ admin/news.php?sitePage=news&pageSection=newsForm&nId=$1

I basically want to be able to have an optional part of the url between "admin" and "news". For instance;

/admin/value/news/edit
or
/admin/news/edit

but still wrapping it all up in the same line, rather than creating an extra line for each additional defintion.

Thanks!

Matt.

Do you want to do something with that "value"? Or just throw it away?
What all is allowed in there? Anything? Just letters and numbers? Is there a specific list of things it can be?

l,
/admin/value/news/edit
or
/admin/news/edit


Hello,

I think the expression ^admin/(.+\/)*edit/([0-9]+)/$ should do it










privacy (GDPR)