Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have previously posted a question but I am not satisfied with the answers. I have a url, for example

I want to write it by rewrite rule as

I am currently using a rule :

RewriteRule ^([a-zA-Z0-9]*-[a-zA-Z0-9]*)$  paper-ads-details.php?a=$1&b=$2&slug=$3   [L]

I am now stuck, does anyone have any suggestions?

share|improve this question
Would you care to post the link to your previous question? – tombull89 Jun 23 '11 at 12:23
Would you care to describe your problem? You've stated your goal and shown us part of your configuration, but you haven't actually presented a problem or question. Additionally, there's no indication that you've performed basic diagnostic steps such as enabling verbose rewrite logging and examining your logs. – larsks Jun 23 '11 at 14:04
You really don't provide enough information in your question. Don't blame people for not answering satisfactorily when you haven't given enough information about your problem. Also do NOT come back under a new account alias, instead improve your previous question until it is answerable and fits the site rules. – Caleb Jun 23 '11 at 20:49
You really have to CLEARLY explain what you want and what is wrong with the responses you are having so far:… ;… – LazyOne Jun 24 '11 at 0:17
up vote 2 down vote accepted

At the very least your RewriteRule is faulty in that it refers to three different callback variables but you only have one group match to reference! Where the 100 and 101 values for a and b are supposed to come from one can only guess. Also the regular expression you wrote won't match the example you gave because it has four sets of dashes, not one. Try this instead:

RewriteRule ^([-a-zA-Z0-9]+)$  /paper-ads-details.php?a=100&b=101&slug=$1   [L]

Note that since I started the character class [] with a dash, the dash is understood as adding a litteral dash to the list of options instead of denoting a range between other characters as in the a-z syntax. This only works because it's the first character. My rule should match a string with any number of dashes, but without any periods along. If a period or other character turns up, it should revert to normal url matching.

share|improve this answer
thank You very much. I have done it. – Granadian Jun 25 '11 at 6:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.