Apache :: Creating Rule For Directory Recursion?
Aug 29, 2013
I have a number of WordPress, Drupal, Wiki sites running under RHEL6.
Apache version:httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Aug 2 2013 08:02:18
We are subject to internal scans by Appscan and Tenable. It is a security requirement so I cannot just block them.
The scanners, of course, attempt to recurse the directory structure and find vulnerable files such as boot.ini, winnt.com and such.
This drives the php content management systems nuts.
Request comes in and is handled by php.
PHP checks the cache for that name and does not find it.
PHP generates a MySQL query and sends it.
MySQL tries and fails to satisfy the query.
MySQL returns result to php.
PHP Writes a cached of the result and presents it to the web.
In other words, a whole lot of processor/memory.
The security scans typically look like......
[Thu Aug 29 00:35:15 2013] [error] [client XXX.XXX.XXX.XXX] Invalid URI in request GET /../../../../../../../../../../../../etc/passwd HTTP/1.1
[Thu Aug 29 00:35:15 2013] [error] [client XXX.XXX.XXX.XXX] Invalid URI in request GET ../../../../../../../../../../../../etc/passwd HTTP/1.1
[Thu Aug 29 00:35:15 2013] [error] [client XXX.XXX.XXX.XXX] Invalid URI in request GET //../../../../../../../../../../../../etc/passwd HTTP/1.1
[Thu Aug 29 00:32:26 2013] [error] [client XXX.XXX.XXX.XXX] Invalid URI in request GET ....................windowswin.ini HTTP/1.1
[Thu Aug 29 00:32:26 2013] [error] [client XXX.XXX.XXX.XXX] Invalid URI in request GET ....................winntwin.ini HTTP/1.1
I have been able to improve performance, speed and security by mod_rewrite
RewriteRule .*.(dll|ini|exe|com)$ - [R=404,NC]
Now (Finally) the question.
I have not been able to create a rule for the directory recursion.
I want to R=404 any that has a "../.." or "...." or ...." but I can not get it to recognize the string correctly.
I believe that this would improve speed and security.
View 2 Replies
ADVERTISEMENT
Oct 26, 2014
in wordpress is wp-includes folder, i dont want anyone just execute file from this directory so it just serve wordpress not any malicious file be executed from there,
so i added this rule into /wp-includes/.htaccess:
RewriteRule ^(wp-includes)/.*$ ./ [NC,R=301,L]
View 2 Replies
View Related
Aug 20, 2007
I have a problem here.
I have 2 domain on 1 account, which one is called domainA.com & domainB.com is an add-on.
I created 2 same subdomain name which are assigned to same subfolder!
subdomain.domainA.com (/public_html/subdomain)
subdomain.domainB.com (/public_html/subdomain)
The question is: How do i change domainB subdomain folder to something else? (eg. /public_html/domainb/subdomain)
View 1 Replies
View Related
Apr 15, 2015
I have following Warning when creating a new Domain inside a Subscriptions:
I found this Article: [URL] .....
But in my case this does not solve the Problem.
1> All permissions are right.
2> When I type command '/usr/local/psa/bin/repair --restore-vhosts-permissions' i get the answer 'Directory permissions were successfully updated.'
3> The Order of Webuser and FTPUser (as described in the article) could also not be the problem, because in my case there is only one user (There is only Webuser and no FTP-User.)
4> When typing '/usr/local/psa/bin/repair --update-vhosts-structure' I get the following error 6 times each:
Code:
[2015-04-15 21:03:30] ERR [util_exec] proc_close() failed
Error: update-vhosts-structure failed: mkdir: cannot create directory `./webroot.kk-bits.com/logs': File exists
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/webroot.kk-bits.com/logs' is in invalid state.
Unable to update the structure of the home directory: an unexpected error has occurred.
update-vhosts-structure failed: mkdir: cannot create directory `./webroot.kk-bits.com/logs': File exists
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/webroot.kk-bits.com/logs' is in invalid state.
To get the error 6 times seems to mean, that i have this problem with 6 Domain.
View 1 Replies
View Related
Feb 21, 2013
I have page like that : [URL] ....
I want to permanent redirect it to : [URL] ....
Also needs to redirect all another page have words ( rates ) to index.
View 9 Replies
View Related
Apr 29, 2013
I need two rules in apache to work
RewriteRule ^([^/]*).html$ index.php?page=$1 [L]
RewriteRule ^([^/]*)/([^/]*).html$ index.php?pnumber=$1&page=$2 [L]
First one rule does work and /index.php?page=something redirect to /something.html
Second rule does not work /index.php?pnumber=1&page=something need to be /1/something.html
But when make this link i got 404 error the request url not found.
Where is error, an how i can make to second rule work too?
View 1 Replies
View Related
Apr 12, 2007
any good rule to limit Apache (port 80) connections from 1 IP to 15 with iptables/csf?
And total connections to the box to 100?
View 6 Replies
View Related
Aug 13, 2014
I need to implement prevent XSS attacks by using apache rewrite following rewrite rules for all urls of the domain.
Converting < and > to < and >
Converting ( and ) to ( and )
Converting # and & to # and &
& --> &
< --> <
> --> >
" --> "
' --> '
View 2 Replies
View Related
Oct 28, 2014
I just installed httpd-2.4.10-win32 and I can't make mod_rewrite to work :
What I'd want is a proxy to receive a print.xxxx.com/appl uri and forwards to appl.serveur.xxxx.com:8080/streammaster
I do
RewriteCond %{HTTP_HOST} print.xxxx.com
RewriteRule /appl/ http://appl.serveur.xxxx.com:8080/streammaster [P]
and I get a redirect : 192.168.250.50 - - [28/Oct/2014:14:55:19 +0100] "GET /appl/ HTTP/1.1" 302 - mod_proxy is loaded and works of course.
I've tried lot of variations (it works the same in a virtual host without rewritecond) to no avail.
View 4 Replies
View Related
May 10, 2014
I am new to wordpress; I want a url rewrite rule for my htaccess. I want when a user visits www.domain.com/services/manu/ the url on the address bar should be www.domain.com/services/. I don't want a permanent redirect.
View 2 Replies
View Related
Feb 21, 2014
I'm trying to change url structure so instead of /default/category/product.html it would show /category/product.html
With this line I've managed to do it on my personal blog
RedirectMatch 301 /default/(.*) //$1
But when I've implemented it on a customers Magento site it started showing double slashes like this //category/product.html and the whole template just collapsed .
View 17 Replies
View Related
Apr 1, 2015
It should be a straight forward change. [URL] .... does not redirect to [URL]...... It simply tries to load /denver-cars/ and denver-cars is in the URL. Am I missing something here? I have tried moving it up and down the list of rules and have tried numerous types of flags to no avail. Everything else in the htacess works fine with out the line:
RewriteRule ^/(.*)-cars/ /newcars-in-$1/ [NC,R=301,L]
Here is my htaccess:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
# Force www
# Redirect google index dir's to new dir
RewriteRule ^/(.*)-cars/ /newcars-in-$1/ [NC,R=301,L]
[code]....
View 1 Replies
View Related
Sep 28, 2013
I am new to apache, and really terrible with regular expressions.
How to craft an htaccess rule that looks a the URL of the page you are visiting, and redirects HTTPS to the same URL in HTTP if the URL contains a certain text string (in the case the word "products")...
View 1 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
Mar 8, 2015
I'm using .htaccess to show existing images instead of images which does not exist.
RewriteBase /images/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)_(.*)1200x900.jpg$ esittely_$21200x900.jpg
RewriteRule liiga1200x10.jpg esittely1200x10.jpg
RewriteRule liiga670x10.jpg esittely670x10.jpg [L]
Everyting works fine if an image does not exist.
But if an image does exist, the second RewriteRule
RewriteRule liiga1200x10.jpg esittely1200x10.jpg
will be used.
Why is that so? How could I modify my code to prevent that?
View 2 Replies
View Related
Jul 5, 2009
i have this error on my log.
what is this.
72 Time(s): BUG: recent printk recursion!
2 Time(s): Firewall: *TCP_IN Blocked* IN=venet0 OUT= <2>BUG: recent printk recursion!
View 9 Replies
View Related
Jan 30, 2013
I am using the following mod_rewrite rule for shortened SEO friendly links: RewriteRule ^blog/([^/]*).html$ /blog/blog.php?pid=$1 [R=301,L]
For Google SEO reasons, will the shortened rewritten link created from above be the permanent link, from the R=301? Even though the longer link is still functional? Or, do I need to create a rewrite match 301 rule to push the long URL to the shortened URL permanently?
View 5 Replies
View Related
Jun 23, 2007
I'm getting this warning from check server security option in csf :
--------
You have a local DNS server running but do not have any recursion restrictions set in /etc/named.conf. This is a security and performance risk and you should look at restricting recursive lookups to the local IP addresses only
--------
I saw named.conf but In fact I didn't understand what should I do
Can somebody tells me what should i do and what this warning trying to tell me?
View 2 Replies
View Related
Jul 16, 2013
We are redoing our website and we have removed / renamed a few old pages. I was wondering if I can do 301 redirect for removed / renamed pages without having to actually create them? To explain with an example:
On old website : www.domain.com/mypage.php
On new website: www.domain.com/mynewpage.php
I created a 301 redirect in .htaccess redirecting mypage.php to www.domain.com/mynewpage.php without physically creating "mypage.php" file. When I access "www.domain.com/mypage.php", I get a 404 page not found error. When I create a blank "mypage.php", the redirection works fine.
Is it possible to do a 301-redirect without having to create old files ?
View 4 Replies
View Related
Jun 5, 2013
Server version: Apache/2.2.22 (Unix)
Server built: Dec 9 2012 18:57:18
OS/X 10.8.4
I am trying to run a shell program to generate a web page. When I enter it as test.cgi, it does exactly what I expect. When I enter it as test.sh
View 2 Replies
View Related
Jan 26, 2015
I got this message now for the second time:
Template processing failed: file = /usr/local/psa/admin/conf/templates/default/domainWebmail.php, error = Template_Exception: No data. file: /usr/local/psa/admin/plib/Template/Processor.php line: 28 code: 0 Previous error: Template_Variable_Exception: No data. file: /usr/local/psa/admin/plib/Template/Variable/AbstractCachedData.php line: 67 code: 0.
How can this happen and how to solve this?
View 3 Replies
View Related
Feb 12, 2015
I'm using PHP cURL with the Plesk API to dynamically create Subscriptions. The problem I'm having is that the Apache server tends to reset before the response is returned, ultimately interrupting the connection.
I found a Plesk setting to define the Apache restart interval. I set it to 120 seconds, which I thought solved the issue, but I'm still having unreliable connection issues.
The request to create/remove a subscription always completes, but it's the response that I'm struggling to have returned.
View 2 Replies
View Related
May 17, 2007
I am trying to get Apache to disable .htaccess overrides and php for a certain directory (and it's subdirectories).
I can disable PHP scripting using a .htaccess file containing:
Code:
Options -ExecCGI -Indexes
I now want to disable .htaccess overrides, which Apache's documentation says is only possible in a <Directory> directive. I have therefore attempted to add the following to the website's Virtual host in httpd.conf:
Code:
<Directory /home/ceejayce/www/dropbox/*>
AllowOverride None
</Directory>
However, the above posted .htaccess file (which is located in /home/ceejayce/www/dropbox/2007/.htaccess) still runs and disables ExecCGI and Indexes. So, it looks like the <Directory> directive is not being processed? I have tried it outside the virtual host, straight into the config file - but it works the same way.
Apache's error log says nothing, other than ExecCGI is off in this directory and Directory Index is forbidden (so basically it's reading the options from the .htaccess file and applying them).
I want to make a folder than can only serve static content (no php etc).
View 1 Replies
View Related
Jul 21, 2007
May be this is a stupid question, but I really don't know why I can't list the files in the root folder of a website(I didn't put any index.html or index.php in the folder).
I point my domain.com to /home/user/docs, the server can list domain.com/test/ files. But it can't list the files of domain.com/. It just shows the page at /var/www/htm, if I don't have any index file under /home/user/docs.
I have this in the httpd.conf file:
<Directory "/home/user/docs">
Options +Indexes
allow from all
</Directory>
View 2 Replies
View Related
Jul 10, 2014
When I enter my_domain.com the browser displays index.php located in httpdocs on my server. When I enter my_domain.com/main/ the browser displays another page, but there's no directory "main" in my httpdocs. Somehow it's redirected to another location (but in URL bar in the browser it's still my_comain.com/main/). I need to find that location.
As I searched through the web, such redirection can be made in .htaccess file, but I can't locate this one either. My server is Apache on CentOS6, and httpdocs directory is located in /var/www/vhosts/my_domain.com. I searched for .htaccess in several locations that I googled, I also tried executing "find / -type d -name '.htaccess'" on PuTTy, but it gives no results.
View 2 Replies
View Related
Apr 20, 2014
When I open my site in a browser and I point the URL to specifically // ipaddress / location A it's all good. (Apache Server)..My problem is, if you open the site in a browser with just the IP address alone it goes there for a second and then automaticlly goes to and opens the other site in location // ipaddress / location B.
However, what I need it to do, I think, is edit the apache conf file to make it open location A as the default. What do I need to do in the apache (httpd-conf) to fix that? For that matter is that the right file to edit?
View 1 Replies
View Related
Oct 15, 2014
I would like to write a rewrite rule that does the following:
RewriteEngine On
Redirect 301 URL...
So what I want is that the first url is rewritten to go to the second ..I have a whole bunch of links that I have to redirect, so I would like to place them all into one .htaccess file or into the default configuration file of apache. So what I do not want is to create SomeFolder1 and someOtherFolder2 and to place a .htaccess file into that place in order to make it work. In fact I want to ignore the folders of the old link and only use the pagename.
View 1 Replies
View Related
Dec 18, 2012
Earlier I made a setup using UNC path in my Apache configuration. I managed to make this work. Now on another installation using Apache 2.2.22 nothing works like before.
This is how my configuration looks like ....
View 4 Replies
View Related
Jan 2, 2014
I have home a server Apache. I want to put all my party songs in one partition and can listen from anywhere without having to take CDs. I have my site in C:Site and the songs I put it in D:Songs.
In php I see the D:Songs directory, I can read subdirectories, I see the .mp3 and .Wav files, I created the playlist, but the audio player doesn't start.
If I move the songs files in C:Site or C:SiteSongs goes perfectly, I can listen my music, but I do not want to be there.
Why I see in D:Songs, but does not want to go? In httpd.conf I have:
DocumentRoot "C:/Site/"
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
and
<Directory "C:/Site/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
I try to put also:
<Directory "D:/Songs/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
bud does not work. "What Can I Do"?
[URL] ....
View 7 Replies
View Related
Mar 10, 2014
What is the proper way. to password protect a directory for apache 2.4.7. Information i gather seems to not work.
View 4 Replies
View Related