Apache :: How To Block A Specific (Query String) URL Via HTAccess
Mar 18, 2013
I don't know how to block a specific QUERY STRING url via .htaccess file, well actually I want to block this type of url :
test.php?q=RANDOMTEXT=&tl=The%20path%20ends
View 2 Replies
ADVERTISEMENT
Feb 21, 2013
I have an [URL] ....
I use htaccess to rewrite it to: [URL] ...
and there is a problem, because I do not get what I need. The result is: [URL] .....
The last / sing dous not even matter, because if I write the url without the ending /, the three dots are still removed.
It looks like everywhere in the url the (in regexp) .+/ pattern is replaced with a simple / sign.
The RewriteRule is very simple, I can not imagine it has anything to do with this, but it looks this:
RewriteRule ^(.*)$ index.php?p=$1 [QSA]
I started to log the rewrite and it looks like if the specific parts of the url are replaced before the rewrite got it.
These are the first few rows of the rewrite log:
add path info postfix: E:/web/service/szerz....odes -> E:/web/service/szerz....odes/action/axgetszerzodesar/ugyfelid/46402/termekid/46032/szerzodesszam/2012.01.01/
strip per-dir prefix: E:/web/service/szerz....odes/action/axgetszerzodesar/ugyfelid/46402/termekid/46032/szerzodesszam/2012.01.01/ -> szerz....odes/action/axgetszerzodesar/ugyfelid/46402/termekid/46032/szerzodesszam/2012.01.01/
applying pattern '^(.*)$' to uri 'szerz....odes/action/axgetszerzodesar/ugyfelid/46402/termekid/46032/szerzodesszam/2012.01.01/'
webserver: Apache/2.2.22 (Win32) PHP/5.2.17
and Apache/2.2.9 (Win32) PHP/5.2.17 (I refreshed it today because of this problem)
os: win7 home premium sp1
It is tested on a linux os too, but there were no such problems.
View 9 Replies
View Related
Dec 30, 2014
I want to match a query string with modrewrite , the problem is that my query_string has a url as value:
%{QUERY_STRING} next=https://play.google.com/store/apps/details?pepe=1
and it doesn't work for me.
input='next=https://play.google.com/store/apps/details?pepe=1'
patttern='next=https://play.google.com/store/apps/details?pepe=1' => not-matched
but if I had to match only the uri , it works , the problem is when I try to add parameters to the query_string url:
http://someurl.com?next=https://play.google.com/store/apps/details?pepe=1
Is there any way to match that kind of query_string?
View 1 Replies
View Related
Jan 5, 2015
I want to permanent redirect some .html page from subdomain to main domain WordPress page,Redirect permanent /cat/FSBO76.URL....
View 1 Replies
View Related
Oct 11, 2009
Is it possible to call a cron job with a query string appended to the file. I have no problem setting up crons in the cron tab..but i'd like the cron to fetch a url that looks something like
/home/php/some-file.php?a=1
is this possible directly through the cron job? I guess an alternative is call some php file that uses curl but i was wondering if there 's a direct way.
View 2 Replies
View Related
Jun 21, 2014
I would like to deny access to .log
View 1 Replies
View Related
Jun 14, 2014
I want to select a specific file by its path using .htaccess to allow access to it.
View 1 Replies
View Related
Jun 12, 2008
Is there any way to block a particular ISP? Have a visitor that changes IP hourly, but the IP always resolves back to a hostname like dsl.yuns.sksk.uk .
I have CSF installed. Any way to block all visitors from dsl.yuns.sksk.uk?
View 3 Replies
View Related
May 20, 2015
I have question: How to redirect specific useragent on specific URLs to specific URLs in .htaccess [Question]
E.g.:
I want to redirect 301 with conditional:
Code:
useragent: Firefox
from my url1: domain[dot]com/old-url1/
from my url2: domain[dot]com/old-url2/
to
Code:
to new url1: in my url1: domain[dot]com/new-url1/
to new url2: in my url1: domain[dot]com/new-url2/
I create this in my .htaccess but not work
Code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} googlebot [NC]
RewriteRule ^/?this-is-url/?$ domain[dot]com [L,R,NC]
View 1 Replies
View Related
Apr 12, 2009
I am getting a lot of GET requests from different IPs to 4 nonexistent PHP files on my server. Is there any way to block the requests to avoid the resources use of apache that these requests are generating?
I have installed mod_security but Im not sure about how the block rule should be.
The requests are going to images/log.php, images/log2.php, images/log3.php and images/logi.php of one of the sites hosted on the server, is there any way to block there requests for a specific domain or path?
View 3 Replies
View Related
Jun 17, 2008
how to block the following "WEB-PHP remote include path" attack using mod_security.
I have tried using Default Mod_Securty and also Mod_security from [url]
But it seems that the mod_security did not functioning well in which PHP inject script still able to run on my server.
The following is the WEB-PHP remote include path that i mentioned about taken from the Apache Access log.
=================================
127.0.0.1 - - [15/Jun/2008:15:09:02 +0800] "GET /?path_escape=http://www.m-comp.nl/prive/includes/js/ThemeOffice/fonts.txt%3f%3f HTTP/1.1" 200 3473
127.0.0.1 - - [15/Jun/2008:15:18:30 +0800] "GET /?path_escape=http://www.m-comp.nl/prive/includes/js/ThemeOffice/fonts.txt%3f%3f HTTP/1.1" 200 3473 ....
View 1 Replies
View Related
May 19, 2014
I'm trying to use spamfilter to block mail from specific address, adding this e-mail to spamfilter in mail account settings, but it doesn't work. In logs I see:
spamc[13430]: skipped message, greater than max message size (256000 bytes).
View 8 Replies
View Related
Dec 9, 2008
I have a client who uses formmail on our dedicated server(another 140 clients also share this PLESK/LINUX server). While the formmail script has not been hacked, some schmuk spends the time to fill it out with spam 5-6 times a day and sends them to the client.
I verified the emails go only to the site owner and nobody else.
QUESTION: Is there a way to exclude the entire world and only allow visitors from the metro Chicago area? This would need to be done via .htaccess and not IPTABLES, as the other sites on the server draw world wide traffic.
I'm scratching my head on this, but if possible it would exclude our schmuk friend while allowing the local traffic this client draws from.
View 5 Replies
View Related
Mar 13, 2007
On my domain access logs, I see a spammer using many different IPs to join my top site list with fake emails. At the end of every line, it contains I am SPAMER! How can I configure htaccess to block this spammer when a request contains that text?
View 3 Replies
View Related
Nov 24, 2014
I'm looking for a way to add a string to the end of an url if it contains a certain string (while using a .htaccess file).
If the url contains: derp.php it will add the following to the end of the url: &code=TEST
E.g. if an url contains derp.php?blabla it will be changed to: derp.php?blabla&code=TEST
How can I accomplish this?
View 2 Replies
View Related
Oct 22, 2009
I have tried, without success, to block approximately 50 crawlers of the Baidu search engine, in China; since this web site can only sell magazines to people with U.S. addresses. The top 6 lines of my .htaccess file are at the bottom of this post.
Someone in OLM Support gave me the below link to webmasterworld. Since nothing I have tried so far has worked, I would appreciate someone knowledgeable about mod_rewrite and .htaccess letting me know whether I can place those 3 lines at the very top of my .htaccess file, or, if they need to be placed lower in the file. (If so, where?)
how to keep the Baidu crawlers out. The site is on Shared Hosting, so trying to keep them out with iptables or something else is not an option for me. They do not look at the robots.txt file or sitemap.txt file, they just come in....
[url]
If your site is on an Apache server, you can block using mod_rewrite via .htaccess:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider [NC]
RewriteRule .* - [F]
I included the [NC] which allows for case differences since at least one of the Baidu bots uses "BaiDuSpider"
deny from baidu.com
deny from crawl.baidu.com
deny from 220.181.7.
deny from 123.125.66.
deny from baiduspider-220-181-7-20.crawl.baidu.com
deny from baiduspider-220-181-7-61.crawl.baidu.com
View 10 Replies
View Related
Apr 22, 2009
if there is anyway to block/redirect the POST request to another page using .htaccess ?
The reason is my site is getting hammer with DDOS attack where they target my index page with request like below: ....
View 5 Replies
View Related
Oct 30, 2014
I've migrated from Apache 2.2 to Apache 2.4 few days ago. It is installed as a service on my Windows 7 developer machine and works in bundle with PHP 5.6.2.
Today I've discovered that GET parameters with Cyrillic characters in URL string are empty.
For example URL looks like this: site.com/search.php?q=%C8%E2%E0%ED%EE%E2
URL-encoded string here is Иванов (%C8%E2%E0%ED%EE%E2)
When I try to use this GET parameter in my PHP script - the variable $_GET['q'] is empty. If I put latin characters in this parameter - $_GET['q'] is taking the corresponding value.
Doesn't look like it's a problem of PHP as I think. Otherwise at least something should stay in the variable. And also I would like to add that this was working absolutely normal on Apache 2.2.
View 9 Replies
View Related
Feb 23, 2013
I need htaccess file for one of my sites. I've searched everywhere, and I can't find a solution for my problem.
System Info:
Easy Apache v3.18.1
CentOS 6.3 (x86_64)
So I'm trying to redirect all URLs in a certain query range to a new website. i.e.,
mydomain.com/?p=35000
mydomain.com/?p=35001
mydomain.com/?p=35002
mydomain.com/?p=35003
etc.
all need to 301 redirect to myotherdomain.com
I don't need to append each query to the new domain. All the URLs simply need to redirect to the naked domain of the other site. So
mydomain.com/?p=35000 is not redirecting to myotherdomain.com/?p=35000
It is simply redirecting to myotherdomain.com
Also, I need to redirect the specific series ([35000-35999]) to the new domain. I want to redirect the www and the non-www URLs.
I've attempted to write the code myself, but when I upload the htaccess file, the URLs are not redirecting. I'm doing something wrong.
Here's what I've tried:
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteCond %{QUERY_STRING} ^p=([35000-35999]*)$
RewriteRule ^(.*)$ "http://myotherdomain.com/" [R=301,L]
View 2 Replies
View Related
Feb 19, 2014
I'm trying to get code to go in a .htaccess file that when a specific IP tries to get a specific page, he/she is redirected to another page.
I have tried many variants of this code below ...
Code:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^12.345.678.90$
RewriteCond %{REQUEST_URI} /requested-page.html$
RewriteRule .* /redirect-to-this-page.html [R=301,L]
... and nothing works. My webserver gets hosed, and my otherwise working system gives me an error when I try to get a page from it. I am, by the way, using Mac 10.6.8, with Apache 2.2 on both server and client.
What will work??
View 6 Replies
View Related
Jan 18, 2014
I have Apache 2.2 installed on my Unix Server and have a couple of Application servers running each of them having similar Document Root.
For example, The URLS will look like below
https://my-test1.com/demo/index.html
https://my-prod1.com/demo/index.html
https://my-qa1.com/demo/index.html
The directory folder looks like
/myapp/my-test1/demo/index.html
/myapp/my-prod1/demo/index.html
/myapp/my-qa1/demo/index.html
I would like to restrict access to the above prod1 URL for a specific set of IP's. How can I achieve this.
View 1 Replies
View Related
Mar 22, 2008
I have the following Apache redirect code in .htaccess:
RewriteRule ^sap-latest-news/([0-9]*)/([A-Za-z0-9_-.]*).htm$ /domain.com/app/modules/content/latestNews.php?id=$1 [L]
This redirect works fine on Apache 2.2.8, but doesn't work on Apache 1.3.41
The following is the entry from error_log:
RewriteRule: cannot compile regular expression '^sap-latest-news/([0-9]*)/([A-Za-z0-9_-.]*).htm$'
A simple Rewrite is working fine in Apache 1.3, but the above regualar expression doesn't seem to be working on Apache 1.3. Does anyone know whether Apache 1.3 doesn't support it?
View 3 Replies
View Related
Nov 1, 2013
configure Apache server to handle users requests using condition based on where he come from so i can redirect him . what i need if user came with from site start with xn--* redirect him to virtual host and if he came from any other link then go to another virtual host
View 2 Replies
View Related
Apr 17, 2014
I'm using Concrete5 CMS to create a website. This CMS creates/manages all its webpages in a mySQL database. Thus, there is no physical folder associated with each webpage, so I can't simply create an .htaccess file and place it in the directory tree in the right sub-folder to restrict access for that sub-folder and all folders it contains.
I have one .htaccess file located at the root level (e.g top-level folder for the website).
QUESTION 1: I need place in this top-level .htaccess file to (1) restrict access to only two specific IP addresses that I can specify (blocking access to all other IP addresses), and (2) specify the URL addresses that I wish to apply this rule to?
For example, let's say my website is [URL] ....
And I want to restrict access to the [URL] ....
and my .htaccess file is located at
/home/myname/public_html/conc/.htaccess
What code can do that?
View 1 Replies
View Related
Feb 19, 2015
How do i redirect URL: example.com/page1 to example.com..i want to redirect any specific page of my site to homepage.
View 3 Replies
View Related
Jun 25, 2013
This is the mod_rewrite rule I'm trying to create. I am very new to Apache admin. Here's the issue:
I have 3 vhosts running on my HTTPD Apache 2.2.24 server: Server1, Server2, Server3. Each vhost is connected to a Weblogic application server. We are trying to prevent access to the Example.portal page on each application server.
So the URLs I'm trying to rewrite are:
- Server1.domain.com/PortalWeb/Example.portal
- Server2.domain.com/PortalWeb/Example.portal
- Server3.domain.com/PortalWeb/Example.portal
So, I would like to redirect the above URLs back to the 'root' of the website. ie: server1.domain.com. Here is my rewrite rule:
RewriteRule ^(.*)/Example.portal$ http://$1 [NC]
So, the rule is matching correctly to URLs that contain Example.portal, however the back reference from (.*) does not seem to map to $1.
View 6 Replies
View Related
Jan 21, 2014
I have been trying to solve a big problem for the last 2 weeks with one of our servers.
The client using our system (web based w/ apache and php) is a contact center firm. They have about 120 operators, all connect to our websever with the same IP.
We have been suffering DoS attacks from some of these operators. This are simple, browser attacks , namely 5 or 10 operators will just hold F5 key and bombard the server with requests when they shouldnt.
We did manage to produce a php protection which will recognize the multiple requests and blacklist the user, but its "too late" because the request have already been sent and processed by the webserver.
We use the user ID in the system to control who should be blacklisted, so this is all dependent on our own authentication.
Ideally, we need something EXACTLY like mod_evasive, but for rejecting single requests instead of blocking the IP. Exemplifying : if a user calls the same url, 5 times, in a 3 second spawn, we will reject every next request for 30 seconds, but only the requests by that user.
If the webserver can make any use of it, the user id is stored in a cookie.
View 4 Replies
View Related
Jan 8, 2013
installing an apache server in Linux centos and run it on any port between 2110 to 2250. I dont have much idea about the installation.
I have logged in to SU and install apache by " yum install httpd"
now how to I host on port betwwen 2110 to 2050 forwarded ports.
View 2 Replies
View Related