Reputation: 110
I'm a bit of a newb with mod_rewrite. I'm trying to adjust my dynamic url for SEO purposes to redirect to a newer and much more SEO friendly version.
Here is my old structure:
RewriteEngine on
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ page.php?cat=$1&title=$2&subid=$3&id=$4
I need to get it to 301 to this new structure.
/ cat / title / subid / genericname_ id /
Thanks in advance for the help.
Upvotes: 0
Views: 103
Reputation: 909
I think this should do it:
RewriteRule ^(.*)/(.*)/(.*)/(?!post_)(.*)/$ http://domain.com/$1/$2/$3/post_$4 [R=301,L]
RewriteRule ^(.*)/(.*)/(.*)/post_(.*)/$ page.php?cat=$1&title=$2&subid=$3&id=$4
This answer covers both redirecting URLs in the old format to the new format and rewriting URLs in the new format to your page.php with parameters. You should be able to replace your current rule with both of these.
Upvotes: 1