Tag Info

New answers tagged

3

If you have control over the OS of the server, you can use fail2ban to block brute-force attempts after a certain number of tries via iptables. You can additionally optionally enable notifications when an IP is blocked. Check this ServerFault question for more information, the Fail2ban site appears down at the moment.


0

There are two lines that are wrong at least: First: rewrite ^(.*)//(.*)$ /%1/%2 redirect; Correct one would be: rewrite ^(.*)//(.*)$ /$1/$2 permanent; In nginx, you reference the captured regexes with $n, where n starts from 1. permanent equals to 301 redirect. redirect is 302 redirect. rewrite ^(.*)$ /index.php?king-rewrite=$0&$query_string ...


0

Your configuration looks correct and tests OK on Apache 2.2.22. Check if you have any mod_expires directives (ExpiresByType or ExpiresDefault) elsewhere that are overriding apache.conf. Start with any .htaccess files in the images path, including the root web folder, /assets/, and /assets/images/. Unless you've disabled the use of .htaccess in those ...


0

The best practice is to move your configuration directives to the actual Apache configuration file (and disallow .htaccess files completely). In this case that will solve your problem because you're no longer dependent on a filesystem location for your directive to take effect... <VirtualHost *:80> ServerName www.example.com ServerAlias ...


0

The best practice is to move your configuration directives to the actual Apache configuration file, and disallow .htaccess files completely. That means you can simply copy all files from DEV to PROD without manual changes.


1

The Apache RedirectMatch directive is a fairly trivial method to do as you ask: RedirectMatch temp ^/Forum/.* http://twitter.com/ourpageForum temp returns a temporary redirect status (302).


0

<rule name="everything to index"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php?q={R:1}" /> </rule>


0

Apache is really, really bad at filtering any kind of requests due to its design (by the time it can learn about the request and drop it or respond with an error, it already used a lot of resources and stuff). What I did and had a big success with was this: Install mod_rpaf or similar in Apache and set it to accept proxy from localhost. Install haproxy on ...


0

Actually, a friend help me out with this. RewriteRule ^test.html http://www.example.com/index#test [R=301,NE,L]


0

EDIT: The real solution to this problem is not putting rewrite rule for proxy to php-fpm in but to do the following: RewriteCond %{REQUEST_URI} -U RewriteRule (.*\.php)$ fcgi://IP:PORT/$1 [P,L] Outside of the tags and inside of the tags. As original solution had a problem: if there was "RewriteEngine On" or any "RewriteRule" related rules/conditions ...


1

It appears you pass all your php execution to your fast cgi server which does not know how to use htaccess so that's why it ignores those files. If you need to use htaccess files by Apache, then you need to execute php scripts by Apache (i.e. using mod_php) instead of passing execution to another service which has no idea about htaccess. You could re-do ...


3

In my opinion your optimizing the wrong thing by strictly forcing certain pages to use HTTPS and other to use plain HTTP. Simply redirect everything to HTTPS and be done with it. The computational cost of HTTPS is negligible in most cases. Your concern about browser cache with SSL seems unfounded as well. And my pet peeve: you're better off including ...


0

You cannot achieve the goal you want in nginx. You have to make the redirection inside your application, that is, add the code to page=login part of the app.


1

You should be able to add more patterns: RedirectMatch 403 /(\{\$itemURL\}|cro|HNAP1|wp|blog|wp/wp-admin|blog/wp-admin|wp/wp-admin/.+|)/?$ Hope this helps.


1

You do not have to specify RewriteCond if you could specify the match in RewriteRule. For example: # /xx/somepage.php -> /somepage.php?ln=xx INTERNAL REWRITE RewriteCond %{REQUEST_URI} ^/../.+ [NC] RewriteRule ^(en|de)/(.*) $2?ln=$1&%{QUERY_STRING} [L] Should work with just: # /xx/somepage.php -> ...



Top 50 recent answers are included