Support

Admin Tools

#12964 How to get a 404 with a string like this ?yrvn

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Monday, 16 July 2012 08:22 CDT

vegasledscreens
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Yes
Have I searched the tickets before posting? Yes
Have I read the documentation before posting (which pages?)? Yes
Joomla! version: 1.5.26
PHP version: 5.2.17
MySQL version: 5.0.17
Host: (optional, but it helps us help you)
Admin Tools version: Godaddy hosting control center

Description of my issue: My domain gets many incoming visitors from sites with a link that normally doesnt exist and it doesnt send it to my normal homepage like www.mypage.com but to www.mypage.com/?yrvn=walmart-4-dollar-drugs-list&id=4355

The thing is that the link doesnt exist but it shows my homepage and it doesnt go to a 404. How can i manage to get a 404 when somebody enters my site through an external link with the variable mypage.com/?yrvn= and block this and send it to a 404??

Richard

nicholas
Akeeba Staff
Manager
Hello Richard,

People, just use Google when you have a question :) Searching for ".htaccess redirect URL based on query" I came the perfect solution. All you need is a .htaccess snippet reading
RewriteCond %{QUERY_STRING} ^yrvn=
RewriteRule .* - [R=404,L]

The first line traps only URLs where the query string begins with ?yrvn=. The second line tells Apache that as long as the first line's conditions are fulfilled, send out a 404 error and stop processing rules.

If you're using the .htaccess Maker feature of Admin Tools you must add this to the "Custom .htaccess rules at the top of the file" section, then click on "Save & Create .htaccess".

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

vegasledscreens
Hi Nicolas,

Thank you very much for your reply. Yes you are right actually before you answered this post I figured out how to do it, and I placed the following into my htaccess:

RewriteCond %{QUERY_STRING} (^|&)yrvn=
RewriteRule (.*) - [L,R=404]


Now it gives me a 404 hehehe...

Thanks a lot...

Greetings,


Richard

nicholas
Akeeba Staff
Manager
You're welcome :)

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!