RedirectMatch don't work - apache

I want to tell to my Apache that i want a redirect permanent rules.
I have theses 2 kinds of hits in my logs:
xx.xxx.xx.x - - [15/Mar/2013:08:14:21 +0100] "POST /oldEndPoint/services/toto HTTP/1.1" 200 - 6003 -
xx.xxx.xx.x - - [15/Mar/2013:08:15:40 +0100] "POST /newEndPoint/services/Tutu/toto HTTP/1.1" 200 - 1316 -
I want to tell to Apache, when he receive hits to /oldEndPoint/services/toto then he should do a redirect permanent (301) to the new url: /newEndPoint/services/Tutu/toto.
I have tried with this rule, but it's don't work, no redirect appear:
RedirectMatch 301 /modBackend/moderation/facebook /modFront/services/Moderation/facebook
Thanks!

You don't need RedirectMatch for simple redirects.
See just Redirect instead. You must give the old URL first and the new one last
Redirect /oldEndPoint/services/toto /newEndPoint/services/Tutu/toto

Related

Unknown behavior in Apache HTTPD

Yesterday we faced a strange behavior when reading access log of Apache httpd. An example of below:
207.46.13.135 - - [25/Sep/2022:15:28:28 +0700] "GET / HTTP/1.1" 302 287 (core.c/0/translate_name) - 140
This is a normal access entry: x.x.x.x - - [26/Sep/2022:14:16:57 +0700] "GET /corp/L003/consumer/theme/vn.ssc.css HTTP/1.1" 200 1043 (core.c/0/handler) - 830
We have directives to proxy and redirect the request going to the system. But why this does not redirect (the return code 302 is understandable when in debug mod but why we don't get it when having in production log) – > We suspected that these IPs used some kind of engines to flood the web server, only to response status but not the content.

Combine www and non-www in Kibana

I setup an ELK stack in AWS Elasticsearch. I'm ingesting Apache logs into ELK, one of the apache fields is the vhost. In the vhost field it will have www.domain.com and domain.com, I'd like to combine those so I can setup accurate searches and visualize data by vhost. Currently it separates www.domain.com and domain.com as separate values.
123.456.7.89 - - [13/Feb/2017:18:56:19 +0000] thisdomain.com "GET /about.html HTTP/1.0" 200 1446 "-" "-" Server=aws8 SSL=- 634713 0
123.456.7.89 - - [13/Feb/2017:18:58:19 +0000] www.thisdomain.com "GET /services.html HTTP/1.0" 200 1446 "-" "-" Server=aws8 SSL=- 634713 0
I entered this data into Elasticsearch setup in AWS which gave me my field definitions. Also works in Cloudwatch.
[ip, user, username, timestamp, vhost, request, status_code, bytes, referrer, browser, server, ssl, timems, times]

Fail2ban filter for a specific string in *access.log

I have many GET Request on my server to "nike-air" URLs like this
216.*.*.* - - [13/Dec/2016:20:07:54 +0100] "GET /jd/nike-huarache-2010.php HTTP/1.1" 404
216.*.*.* - - [13/Dec/2016:20:07:57 +0100] "GET /jd/nike-roshe-run-homme-original.php HTTP/1.1" 404
187.*.*.* - - [13/Dec/2016:20:17:26 +0100] "GET /jd/nike-mercurial.php HTTP/1.1" 404
I decide to create a fail2ban filter for stop it:
# apache-nike.conf
[Definition]
failregex = ^<HOST> -.*"GET .*nike-.*".*
ignoreregex =
It works but I think it can be improved? Too bad there is no online tool to create filters :)
Thank you for your suggestions.

Apache 500 Error due to User Agent?

I am currently getting 500 errors from Apache using a alarming probe shell script that has been provided to myself.
Unfortunately I have not been able to get to the bottom of why the script generates a 500 error when attempting to access content locally on the server but using other methods like wget and telnet works fine.
The following are the Apache access log entries for each of the attempts:
Using Wget
127.0.0.1 - "" [19/Mar/2013:14:31:44 +1100] "GET /index.html HTTP/1.1" 200 1635 "-" "Wget/1.13.3" "-"
Using Telnet
127.0.0.1 - "" [20/Mar/2013:13:12:11 +1100] "GET /index.html HTTP/1.1" 200 1635 "-" "-" "-"
Using the Probe Scripts
127.0.0.1 - - [19/Mar/2013:14:33:56 +1100] "GET /index.html HTTP/1.1" 500 - "-" "" "-"
The only difference I can see is that the probe has a - instead of a "" in the user agent (3rd item) which either way tells me it wasn't passed in any of the instances (as this is expected since there is no authentication).
I've bumped up the logging for everything in Apache and can't figure out what is amiss. There is no processing involved, it's a static file, and I have attempted with other file types too, like images to no avail.
Does anyone have any ideas or has seen something similar?
Thanks,
Tony

Modrewrite - htaccess problem

i have this in my .htaccess
RewriteRule ^search/([^/\.]+)\/(.*)$ search.php?s=$1&currentpage=$2 [L]
explantion: "s" is search term and "currentpage" is the pagination
ok when some body searches "bla bla" it works but when somebody searches now "bla bla videos"
"s" dont gets sets
here are some apache log with videos
- - [18/Aug/2011:10:49:13 -0700] "GET /search/bla-bla-videos/ HTTP/1.1" 200 32444
and now without videos
- - [18/Aug/2011:10:51:17 -0700] "GET /search/bla-bla/ HTTP/1.1" 200 32797 ?s=bla-bla&currentpage=
so im thinking somehow videos conflicts with the .htaccess
any ideas how to fix that?
Thanks