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

661
Visualizações
Flutter web 404 without hash on apache no htaccess

I'm trying to enable direct url handling on my Flutter app. I am using beamer and the app works as expected with deep linking within an app emulator, and when using the chrome web browser emulator through vscode.

When I publish the code though, only the main page works. Directly accessing the url doesn't.

When I switch back to the /#/ strategy, everything works and I can access anywhere in the app directly.

This means that the app is not loaded and only the Apache webserver is returning a 404 because it does not recognize index.html of the flutter jS file to be a cgi.

Awhile back I worked with php and there was a way to access url's without using extensions and an override in httpd.conf setting.

Has anyone got this working for flutter navigation 2.0 compiled for web on an apache webserver?

Thanks

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

0

create a .htaccess file in the root directory:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.html [L]
</IfModule>

Edit httpd.conf for that root directory:

DocumentRoot "/Users/myname/myapp/build/web"
<Directory "/Users/myname/myapp/build/web">
          Options FollowSymLinks
          AllowOverride All
          Order allow,deny
          allow from all
</Directory>

Visit: yoursite.com/path/to/flutter/page or wherever you have a route parser

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