Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14625 reviews 1734 hosting providers

Questions & Answers

How to generate error 404 with .htaccess

Apr 29, 2012 by Mrnewguy
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 votes
Apr 29, 2012 by lionhost
try adding the below code into the your .htaccess file.

ErrorDocument 404 /notfound.html
0 votes
Apr 29, 2012 by WebGuru
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]