0

Using htaccess to block port in apache?

Is it possible?

3 Answers 3

3

No.

In order to have Apache process the .htaccess file's directives the port needed to be open, and a client needed to connect to it.

What you might be looking for is using iptables to block the port.

2

You theoretically CAN use rewrite rules in .htaccess using the %{SERVER_PORT} variable to do something different with requests coming in on a specific port, which could also mean denying access to resources.

However, this is almost certainly not the best way to get to what you're trying to accomplish.

1

please use RewriteCond %{SERVER_PORT} !3306$

You must log in to answer this question.