P
P
private242015-10-23 17:55:09
Apache HTTP Server
private24, 2015-10-23 17:55:09

How can I block the link with the request?

Good afternoon.
Task :
You need to make a redirect when you follow a link or
when you manually type a URL in the browser bar with a request like www.example.com?act=delete
There is such a rule in .htaccess that works

RewriteCond %{QUERY_STRING} act
RewriteRule (.*) http://www.example.com/? [R=302,L]

But there is a problem, there are forms on the page in which the same parameters are sent using the GET method, after which the data should be deleted. For example www.example.com?act=delete&id=1. And the request does not occur, because it immediately redirects to the main site
Question:
So, how to prohibit the transition to the url and allow the forms to send data?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2015-10-23
@privat24

This is VERY bad practice when data changes are made via GET. I can write right here in the comments

<img src="www.example.com/?act=delete&id=1">
<img src="www.example.com/?act=delete&id=2">
<img src="www.example.com/?act=delete&id=3">
<img src="www.example.com/?act=delete&id=4">
<img src="www.example.com/?act=delete&id=5">
<img src="www.example.com/?act=delete&id=6">
<img src="www.example.com/?act=delete&id=7">
<img src="www.example.com/?act=delete&id=8">

At the same time, YOUR browser with YOUR rights will make all these requests and delete everything to hell.

I
Ivanq, 2015-10-23
@Ivanq

You can even without RewriteRule - it's easier to process on the site itself on the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question