regex – regular expression (PHP) to handle URLs

Staff I am on the last stretch to finish my project and I need the help of the most experienced regular expression! I will explain … In my project, I only use a friendly URL. I am not a very boring guy. I do not use any CMS like WordPress or anything, I create everything in my hand, and I want to process the data that come in through the URL, this is not for J & # 39; have a CMS and I want to be able to do it.

I have my URL (suggesting):

my website /

I had to create another regular expression to remove the special characters, allowing only the letters a-z and digits 0-9, as well as dashes and bars.

if you have:

my-site // page! +! ////! @ 3 ()


if the user types:

my website ///////

the same page will load … so I've created something to process the bars and redirect with just one bar, and I've done the same thing with the query character


now I've planted general, so I can not anymore because I did not think that when I have a parameter coming from the URL via GET, for example a search:

my website /? s = a

I need an expression that preserves my parameter, and for example if I type anything before? S = ", or in the middle, it processes and renders what I'm saying. he was … after he does not need so after equal navigation understands how the search word …

if I have my website / !! @ SSDwe? s = a or my website / ??? sQ! = a , things like, the expression must treat and leave like that!

my website /? s = a

I appreciate the attention and help, my knowledge does not go beyond!