Angular 5 .htaccess i apache

0

Witam.
Mam problem z routingiem, a raczej z odświeżaniem strony co może być zależne od routingu. Wrzuciłem .htaccess do folderu ze stroną, znalazłem gdzieś na gicie:
Github .httaccess for Angular

#Angular rewrites
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

# If the requested pattern is file and file doesn't exist, send 404.
# This fixes the issue with Angular being included more than once
# when you get the path of a component template wrong.
RewriteCond %{REQUEST_URI} ^(\/[a-z_\-\s0-9\.]+)+\.[a-zA-Z]{2,4}$
RewriteRule ^ - [L,R=404]

RewriteRule ^(.*) /index.html [NC,L]

Nie mogę odświeżyć strony jak jestem, powiedzmy, na edycji pozycji np. www.mojastrona.pl/element/21 po odświeżeniu strony dostaje 404 Not found.

0

Spróbuj dodać:

<Directory "/var/www/html/dist">
  AllowOverride All
</Directory>
0

Nie jestem pewien czy mam to dodać do .htaccess czy do sites-enabled w apache?

0

Zdaje się (uczę się tego od wczoraj), że powinieneś to dodać do głównego pliku konfiguracyjnego Twojego serwera – u mnie na linuksie (Apache 2.4) to jest /etc/httpd/conf/httpd.conf.

Z dokumentacji:

In general, .htaccess files use the same syntax as the main configuration files. What you can put in these files is determined by the AllowOverride directive. This directive specifies, in categories, what directives will be honored if they are found in a .htaccess file. If a directive is permitted in a .htaccess file, the documentation for that directive will contain an Override section, specifying what value must be in AllowOverride in order for that directive to be permitted. [ https://httpd.apache.org/docs/2.4/howto/htaccess.html ]

Co do podstaw, bo dobrze znać jednak podstawy (przy okazji: też nie cierpię się uczyć):

1 użytkowników online, w tym zalogowanych: 0, gości: 1