homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

how to 404 parameters added to end of url?

Msg#: 4176966 posted 11:22 pm on Jul 26, 2010 (gmt 0)

For some reason, when you add parameters to any page of my site, it shows the page. I'd like it to 404. How do I do this?



that should 404 as it's not a valid url, but it shows mysite just fine.

same with


That shows the page.




WebmasterWorld Senior Member 5+ Year Member

Msg#: 4176966 posted 1:50 am on Jul 27, 2010 (gmt 0)

One solution would be something in your PHP to check that there is a query string ($_SERVER['QUERY_STRING']) and if there when you don't expect one give a response of 403 (Forbidden).
A 403 response is better than a 404 as it tell the requester not to try it again.


Msg#: 4176966 posted 2:19 am on Jul 27, 2010 (gmt 0)

But this isn't related to any php script... my server just won't ignore parameters added to the end of any URL... those parameters should be seen as foreign and return 404.


That doesn't exist... so should return 404 but just returns a 200 for

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4176966 posted 7:00 am on Jul 27, 2010 (gmt 0)

# Block ALL URLs with appended query string
RewriteCond %{QUERY_STRING} .
RewriteRule .* - [G]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved