logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Migrating from Apache 2.2 to Apache 2.4
Author
kam270



Joined: 02 Nov 2021
Posts: 1
Location: LONDON

PostPosted: Tue 02 Nov '21 21:48    Post subject: Migrating from Apache 2.2 to Apache 2.4 Reply with quote

I need to make this htaccess file work in apache 2.4. It seems apache 2.4 does not like it.

Code:
Order Allow,Deny
Deny from all
I changed that to


Code:
  <FilesMatch "\.(htaccess|htpasswd|ini|psd|log|sh|crt|gitignore|md)$">
          Require all denied
    </FilesMatch>


Here are some errors I have seen so far implementing it:

Code:
AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh) AH01797: client denied by server configuration: /var/www/html/


And here is the htaccess file I am trying to make work in Apache 2.4. Can you spot anything else Apache 2.4 would not like ?

Code:

Options -Indexes
   
    <FilesMatch "\.(htaccess|htpasswd|ini|psd|log|sh|crt|gitignore|md)$">
        Order Allow,Deny
        Deny from all
    </FilesMatch>
    <Files 8fjfsuUhhhhh8/*>
        deny from all
    </Files>
    <Files backups/*>
        deny from all
    </Files>
    <Files stats/*>
        deny from all
    </Files>
    <Files icons/*>
        deny from all
    </Files>
    <Files error/*>
        deny from all
    </Files>
    <Files logs/*>
        deny from all
    </Files>
    <Files git/*>
        deny from all
    </Files>
    <Files .git/*>
        deny from all
    </Files>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^blog/(.*)$ https://blog.mysite.com/$1 [R=301,NC,L]
   
        # Old Site Redirects
        RewriteRule ^retailers($|/$) /merchants/ [R=301,NC,L]
        RewriteRule ^faqs($|/) /FAQ/ [R=301,NC,L]
        RewriteRule ^contact($|/) /contact-us/ [R=301,NC,L]
        RewriteRule ^login($|/) /customer-login/ [R=301,NC,L]
        RewriteRule ^bank-vision($|/) /FAQ/ [R=301,NC,L]
   
        # New Website Proxying
        # Handle Request to index
        RewriteCond %{THE_REQUEST} ^GET\ /\ .*
        RewriteRule . http://mysite.com.s3-website.eu-west-2.amazonaws.com/ [P]
   
        # Handle all the named pages
        RewriteRule ^(merchants|how-it-works|shop-directory|contact-us|terms-of-use|privacy-policy|complaints-policy|careers|FAQ|error)($|/) http://mysite.com.s3-website.eu-west-2.amazonaws.com/$1$2 [P]
   
        # Handle the various static elements
        RewriteRule ^static/(.*)$ http://mysite.com.s3-website.eu-west-2.amazonaws.com/static/$1 [P]
        RewriteRule ^page-data/(.*)$ http://mysite.com.s3-website.eu-west-2.amazonaws.com/page-data/$1 [P]
        RewriteRule ^([^\/]*).js$ http://mysite.com.s3-website.eu-west-2.amazonaws.com/$1.js [P]
        RewriteRule ^icons-(.*)/(.*)\.(png|jpg)$ http://mysite.com.s3-website.eu-west-2.amazonaws.com/icons-$1/$2.$3 [P]
   
        # Handle request to homepage with get parameters
        RewriteCond %{THE_REQUEST} ^GET\ /\?utm_source=([^\s&]+)
        RewriteRule . http://mysite.com.s3-website.eu-west-2.amazonaws.com/ [P]
        RewriteCond %{THE_REQUEST} ^GET\ /\?ref=([^\s&]+)
        RewriteRule . http://mysite.com.s3-website.eu-west-2.amazonaws.com/ [P]
   
        # Legacy Platform stuff
        RewriteRule ^(frontend/process/process/components|admin-lf7/ui/ajax|frontend/ajax|8fjfsuUFks988/cron)($|/) - [L]
        RewriteRule ^rt8aglCo7XfQOxxQH2mTDZw45675675675567P27da4t1T1yJIB5Be58ih /admin.php [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^?\ ]*\.php[/?\ ]
        RewriteRule .*\.php$ index.php [L]
    </IfModule>


When I use this .htaccess file from AWS beanstalk examples I can see the site ok :

Code:
<IfModule mod_rewrite.c>
    Options -MultiViews

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 03 Nov '21 23:58    Post subject: Reply with quote

You need to change all Order ... to Require

The Order ... works only if you enable mod_access_compat. But that is not recommended.

also run httpd -S to check the syntax.

Quote:
AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh) AH01797: client denied by server configuration: /var/www/html/


Well someone tried to hack your server.
Back to top


Reply to topic   Topic: Migrating from Apache 2.2 to Apache 2.4 View previous topic :: View next topic
Post new topic   Forum Index -> Apache