love
love

Reputation: 1391

Apache Rewrite problem

  1. http://www.a.com/content/1
  2. http://www.a.com/content/seo-text-1

    RewriteRule ^content/(\d+)|.+?-(\d+) action/index.php?id=$2

This rule don't work second url, How to fix it?

Thank you

Upvotes: 0

Views: 63

Answers (1)

Petr Kozelka
Petr Kozelka

Reputation: 8000

If for any reason you need to have it in single rule, you can use this:

RewriteRule ^content/(.*)-?(\d+)$ action/index.php?id=$2 [R]

But more readable solution is to use two rules:

RewriteRule ^content/(\d+)$ action/index.php?id=$1 [R]
RewriteRule ^content/.*-(\d+)$ action/index.php?id=$1 [R]

Upvotes: 1

Related Questions