Search

I'd like to redirect the visitor to 404 when the URL parameter is invalid, but not if it is empty.

For example:

  1. $root/products is ok
  2. $root/products/validcat is ok
  3. $root/products/garbage is 404

Clearly the second one is ok since the datasource will return results. The third is ok too since I can set the "Redirect to 404 page when no results are found" for the datasource, but this breaks the first.

Any ideas?

Thanks.

Combine this with adding the option for "Required URL Parameter" with {$category} (or whatever your URL parameters is).

This will have the following effect: if $category is empty, return no results. Then the page will redirect to 404 if "Redirect to 404 page..." check box is checked.

Thanks, I was missing the curly braces for the required URL parameter.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details