How to generate error 404 with .htaccess

81 views
asked Apr 29, 2012 in Website Builder by Mrnewguy (440 points)
hi all..I’m using Joomla with SEF enabled and I have my .htaccess enabled with some standard mandatory rules active. I want to generate error 404 only when the syntax “fontstyle=f-large” or the syntax “fontstyle=f-smaller” is part of the URL, whether it’s generated by the serf engine or if there is another character before that syntax such as backslash or anything else. Is this possible? If so can you please let me know how to do it?

Thank you

2 Answers

0 like 0 dislike
answered Apr 29, 2012 by lionhost (4,060 points)
try adding the below code into the your .htaccess file.

ErrorDocument 404 /notfound.html
0 like 0 dislike
answered Apr 29, 2012 by WebGuru (9,280 points)
It's possible. You can use the REQUEST_URI server variable instead of QUERY_STRING and the [OR] flag to redirect on either condition.
You can use this Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} fontstyle-f-larger [OR]
    RewriteCond %{REQUEST_URI} fontstyle-f-smaller
    RewriteRule .* - [G,L]
</IfModule>
...