Lawrence
Lawrence

Reputation: 727

Rewriting with RewriteCond

I've got a rewrite rule

      RewriteCond    !^ about/([A-Za-z0-9-]+)?$ [NC]
      RewriteRule    ^([A-Za-z0-9-]+)?/([A-Za-z0-9-]+)?$                        pages/details.php?adid=$1&alias=$2                                          [NC,L]

The rule is working fine till i added the cond. Then pages started not loading.

Upvotes: 1

Views: 27

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

You are not using RewriteCond correctly. The condition's first argument is what to match against, like a variable, or a string. The second argument is the condition to place on the first argument. In this case, it looks like you're trying to limit the URI against a regex, so maybe you want something like this?

RewriteCond %{REQUEST_URI} !^about/([A-Za-z0-9-]+)?$ [NC]
RewriteRule ^([A-Za-z0-9-]+)?/([A-Za-z0-9-]+)?$ pages/details.php?adid=$1&alias=$2 [NC,L]

Upvotes: 1

Related Questions