Scenario:
http://www.example.com/directory/product-example.com is a 404 (wanted behavior; product is gone.)
When I go to:
http://example.com/directory/product-example.htm I end up with this:
http://www.example.com/product.php?pid=product-example (this is my native URL structure before mod_rewrite -- I get 301 response, which then redirects to a 404 because the pid string is invalid. ...it shows the rewritten URL in the querystring instead of the product id; which was 488 (before it was deleted).
How can I prevent this?
Here's the snippet from htaccess which redirects *.example.com to www.example.com and I believe this is the culprit for the 301 response:
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
I want *.www.example.com to retain the URL structure.. so instead of the redirect to my native URL structure, I should be seeing:
http://example.com/directory/product-example.com with NO 301; just a 404 response.