Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
How to enable mod_redirect in htaccess over HTTP/2

I've modified my Debian 9 installation (Apache 2.4.25) to allow HTTP/2 support.

I've successfully checked it online, and the pages do serve, but the problem lies with the redirection performed in .htaccess to map for example site.com/index.php/brands/mybrand to a nice url (site.com/brands/mybrand). It simply does not happen. This is a Codeigniter setup.

  • The problematic steps seem to be when I disable the current modules (a2dismod php7.2 and mpm_prefork) and I enable a mpm module(a2enmod mpm_event, but I also tried mpm_worker) that supports HTTP/2.
  • At that point I get "file not found" (404 error)
  • By reverting those two steps I get back to normal (no HTTP/2 of course)

Is the mod_rewrite.c conditional below invalidated by loading the mpm_worker module? If so how do I replace it?

EDIT: a detailed Log show me this error: AH01071: Got error 'Primary script unknown\n', referer: https://sitename.com/brands/

My .htaccess (in the brands directory where index.php resides) which works fine with the previous configuration is:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>

<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>
IndexOptions +Charset=UTF-8

My /etc/apache2/sites-enabled/default-ssl.conf relevant content includes:

<VirtualHost _default_:443>
         # even without enabling here h2c or h2 I get the error
         Protocols http/1.1
         <Directory "/var/www/html">
                 Options Indexes FollowSymLinks MultiViews
                 AllowOverride All
                 # since apache 2.4
                  Require all granted
         </Directory>

</VirtualHost>

Note: Other commands that I previously run to enable additional modules required are these ones below. I didn't have to touch anything of this to revert back to a working (non HTTP/2) configuration:

apt-get install php7.2-fpm
a2enmod proxy_fcgi setenvif
a2enconf php7.2-fpm

Edit:

The problem was because of an internal redirect. It is fixed now.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You have not configured PHP-FPM correctly. Disable that php-fpm configuration by saying a2disconf php7.2-fpm. And add the following in the httpd.conf file, this should work:

<FilesMatch "\.php$">
SetHandler  "proxy:fcgi://localhost:9000"
</FilesMatch>
ProxyErrorOverride On

Restart Apache and PHP-FPM (PHP-FPM restart probably not required, but Apache must be restarted). Enable HTTP/2 now, it should work probably.

Edit

The OP had this problem from some redirect in the configuration.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda