2

I have a page that is the "template" to hold item information, for example:

https://example.org/item/

Normally though, a user will only ever get to this page with a query string attached

https://example.org/item?name=Dishwasher

If they remove the query string they will be brought to an empty template page.

I was thinking of re-directing this template page (possibly to homepage) through my .htaccess file but I'm wondering if this is bad for SEO?

0

I was thinking of re-directing this template page (possibly to homepage) through my .htaccess file but I'm wondering if this is bad for SEO?

It won't do anything for SEO. Google may just treat it as a soft-404 and users may just be left wondering what's going on (although they shouldn't be there anyway). I would perhaps serve an informative 404 with appropriate links to your homepage and other parts of your site. Search engines then get the message to not index the page (without a query string). In .htaccess you could do something like the following to serve a 404 to any URL that starts /item, but excludes a query string:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^item - [R=404]

However, I think it would be preferable to manage this in your server-side code, not .htaccess. The .htaccess solution wouldn't be able to catch ?name=nonsense for instance. If your script determines that an "empty template page" would be served (invalid template name, no template name or nothing at all) then serve a meaningful 404 instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.