Hi Everyone!:)

Searched net up'n down and also related threads but can't figure this one.

I have this:

RewriteRule ^(\w+)$ index.php?pageid=$1[icode] for the purpose of pretty urls.

Now, as long as pageid is a single word, everything's nice, but if there are dashes
(kinda-like-this) it simply doesn't work, that is, the ?pageid is not being sent to my php script.

Tried replacing (\w+) with (.*) - gives me very weird behavior and not working.

Thanks in advance.

PS. not to come empty handed to this cool forum, here's a nice thingy that will explain any regular expression you paste into it:

http://rick.measham.id.au/paste/explain.pl?regex=^%28\w%2B%29%24

and even that didn't help me..nOOB..

Recommended Answers

All 2 Replies

\w matches a word character, which are letters, digits and underscores. I think you can replace it with ([\w\-]+)

Worked perfectly, thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.