Forum Moderators: phranque

Message Too Old, No Replies

trying to create rule

         

dend

5:34 pm on Mar 23, 2006 (gmt 0)

10+ Year Member



Hi,
I am trying to create such rewrite rule:

[domain.com...]
would be posted to: index.php?a=forum&b=theme&c=article

and lets say: [domain.com...]
would be posted to: index.php?a=forum&b=theme&c=

After searching and reading lots of manuals I have discovered this rule:

RewriteEngine On
RewriteRule ^(.*)/(.*)/(.*)+ index.php?a=$1&b=$2&c=$3

but for some case this rule is not working good for search engines. You get identical content by visiting both:
[domain.com...]
and
[domain.com...]

and search engines index only [domain.com...] (without backslash on the end of URL)

Can someone tell where is bug on rewrite rule?

jdMorgan

5:54 pm on Mar 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to require the trailing slash, and end-anchor your pattern:

RewriteEngine on
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ /index.php?a=$1&b=$2&c=$3 [L]
RewriteRule ^([^/]+)/([^/]+)/$ /index.php?a=$1&b=$2&c= [L]
RewriteRule ^([^/]+)/$ /index.php?a=$1&b=&c= [L]

Jim