https://iphwiki.net/index.php?title=Symfony_4_-_404_%D0%BD%D0%B0_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0%D1%85_-_%D1%81%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%8B%D0%B9_htaccess_%D1%84%D0%B0%D0%B9%D0%BB&feed=atom&action=historySymfony 4 - 404 на страницах - стандартный htaccess файл - История изменений2024-03-28T14:53:04ZИстория изменений этой страницы в викиMediaWiki 1.35.0https://iphwiki.net/index.php?title=Symfony_4_-_404_%D0%BD%D0%B0_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0%D1%85_-_%D1%81%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%8B%D0%B9_htaccess_%D1%84%D0%B0%D0%B9%D0%BB&diff=10334&oldid=prevAdmin iph в 15:55, 21 июля 20212021-07-21T15:55:36Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="ru">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Предыдущая</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Версия 15:55, 21 июля 2021</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Строка 1:</td>
<td colspan="2" class="diff-lineno">Строка 1:</td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Файл:B_1.gif |link=https://bit.ly/3tbFsd6| Доступная цена]]</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== Symfony 4 - 404 на страницах - стандартный htaccess файл ===</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=== Symfony 4 - 404 на страницах - стандартный htaccess файл ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Admin iphhttps://iphwiki.net/index.php?title=Symfony_4_-_404_%D0%BD%D0%B0_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0%D1%85_-_%D1%81%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%8B%D0%B9_htaccess_%D1%84%D0%B0%D0%B9%D0%BB&diff=10328&oldid=prevAdmin iph: Новая страница: «=== Symfony 4 - 404 на страницах - стандартный htaccess файл === Стандартный htaccess файл для Symfony 4 чтобы...»2021-07-21T15:39:41Z<p>Новая страница: «=== Symfony 4 - 404 на страницах - стандартный htaccess файл === Стандартный htaccess файл для Symfony 4 чтобы...»</p>
<p><b>Новая страница</b></p><div>=== Symfony 4 - 404 на страницах - стандартный htaccess файл ===<br />
<br />
<br />
Стандартный htaccess файл для Symfony 4 чтобы убрать 404 ошибку на дополнительных страницах:<br />
<br />
<syntaxhighlight lang="php"><br />
# Based on http://stackoverflow.com/questions/17313023/symfony-2-2-1-url-rewrite-issue<br />
# Modified to use index.php as per symfony >= 4.0 installer<br />
<br />
# Use the front controller as index file. It serves as fallback solution when<br />
# every other rewrite/redirect fails (e.g. in an aliased environment without<br />
# mod_rewrite). Additionally, this reduces the matching process for the<br />
# startpage (path "/") because otherwise Apache will apply the rewritting rules<br />
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).<br />
DirectoryIndex index.php<br />
<br />
<IfModule mod_rewrite.c><br />
RewriteEngine On<br />
<br />
# Redirect to URI without front controller to prevent duplicate content<br />
# (with and without `/index.php`). Only do this redirect on the initial<br />
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an<br />
# endless redirect loop (request -> rewrite to front controller -><br />
# redirect -> request -> ...).<br />
# So in case you get a "too many redirects" error or you always get redirected<br />
# to the startpage because your Apache does not expose the REDIRECT_STATUS<br />
# environment variable, you have 2 choices:<br />
# - disable this feature by commenting the following 2 lines or<br />
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the<br />
# following RewriteCond (best solution)<br />
RewriteCond %{ENV:REDIRECT_STATUS} ^$<br />
RewriteRule ^index\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L]<br />
<br />
# If the requested filename exists, simply serve it.<br />
# We only want to let Apache serve files and not directories.<br />
RewriteCond %{REQUEST_FILENAME} -f<br />
RewriteRule .? - [L]<br />
<br />
# cache-bust assets url rewrite<br />
# Example format: /cpv-10/js/test123.js -> /js/test123.js<br />
# This allows us to change the asset version and "bust" intermediate caches (like varnish)<br />
# See http://symfony.com/doc/current/reference/configuration/framework.html#ref-framework-assets-version<br />
# See http://symfony.com/doc/current/reference/configuration/framework.html#assets-version-format<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^cpv-\d+\/(.+)$ $1 [L]<br />
<br />
RewriteCond %{REQUEST_FILENAME} -f<br />
RewriteRule ^(.*)$ index.php [QSA,L]<br />
<br />
# The following rewrites all other queries to the front controller. The<br />
# condition ensures that if you are using Apache aliases to do mass virtual<br />
# hosting, the base path will be prepended to allow proper resolution of the<br />
# index.php file; it will work in non-aliased environments as well, providing<br />
# a safe, one-size fits all solution.<br />
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$<br />
RewriteRule ^(.*) - [E=BASE:%1]<br />
RewriteRule .? %{ENV:BASE}index.php [L]<br />
</IfModule><br />
<br />
<IfModule !mod_rewrite.c><br />
<IfModule mod_alias.c><br />
# When mod_rewrite is not available, we instruct a temporary redirect of<br />
# the startpage to the front controller explicitly so that the website<br />
# and the generated links can still be used.<br />
RedirectMatch 302 ^/$ /index.php/<br />
# RedirectTemp cannot be used instead<br />
</IfModule><br />
</IfModule><br />
</syntaxhighlight></div>Admin iph