Forum Moderators: phranque
http://www.website.com/catalog/hONDA_ACCORD_p_164.html
http://www.website.com/product.php?productid=164
RewriteRule ^_p_(.*)$ http://www.website.com/product.php?productid=$1 [NE,R=301,L]
^_p_(.*)$ ^([^_]+)_p_([0-9]+)$ might be useful. ^([^_]+_)+p_([0-9]+)$ might work. example.com/this-product-is-junk_p_456 your site should NOT serve content with "200 OK" status, it should instead redirect to example.com/acme-widget_p_456 and only then should it serve the content. /p414-slug-text makes the pattern matching a lot easier. RewriteRule syntax but have completely different end results.
I have tried
^([^-]+-)-p-([0-9]+)$
and
^([^-]+)-p-([0-9]+)$
RewriteRule catalog/[a-z_]+-p-(\d+)\.html product.php?productid=$1 [NC,L]
Options +FollowSymLinks should appear only once. RewriteEngine on should appear only once. ErrorDocument 404 http://www.example.com/x/pages.php?pageid=35 is SEO SUICIDE. It produces a 302 redirect to a different URL. Remove the domain name from this. You need to serve 404 status at the originally requested URL. I have a custom 404 redirect right now, when I type in the old page, it gets redirected to the custom 404.
I removed the custom 404 for testing, I then type in the URL with the -p- code, and it dies.
An Example of what I wish to convert
www.examplecom/x/catalog/-SWITCHES-EVERYTHING-COMPONENT- VGA-HDMI-W-REPEATER-SELECT-p-13299.html
and
www.example.com/x/catalog/PYRAMID-PB617X-ARTIC-4-CHANNEL- AMPLIFIER-p-6348.htm
where I want to extract the # after -p- (6348 above) to
http://www.example.com/x/product.php?productid=6348
RewriteRule catalog/[A-Z0-9 \-]+[A-Z0-9]-p-([0-9]+)\.html http://www.example.com/x/product.php?productid=$1 [R=301,L]