Przejdź do głównej zawartości

2 posty z tagiem "cms"

Wyświetl wszystkie tagi

Błąd 404 w WordPress: skąd się bierze i jak go naprawić

· 3 min aby przeczytać
Customer Care Engineer

jak-naprawic-błąd-404-strona-nie-znaleziona-w-WordPress

Błąd 404 Not Found — jeden z najczęstszych problemów, z jakimi mierzą się właściciele stron opartych na WordPressie. Komunikat pojawia się, gdy serwer nie może znaleźć strony żądanej przez użytkownika. Przyczyną może być nieprawidłowe ustawienie linków, usunięta treść lub nawet problem z szablonem strony.

Jeśli błąd nie zostanie rozwiązany, może negatywnie wpłynąć na doświadczenie użytkownika oraz pozycję strony w wynikach wyszukiwania. W tym artykule znajdziesz konkretne informacje na temat tego, skąd bierze się błąd 404 w WordPressie i jak skutecznie się go pozbyć.


Co oznacza błąd 404 w WordPress

Gdy ktoś odwiedza Twoją stronę, WordPress próbuje dopasować adres URL do wpisów w bazie danych. Jeśli nie znajdzie strony — pojawia się komunikat 404. To nie jest awaria serwera — strona działa, ale konkretny adres jest nieprawidłowy lub nie istnieje.


Dlaczego błąd 404 pojawia się w WordPress

  1. Nieprawidłowa struktura bezpośrednich odnośników

To jedna z najczęstszych przyczyn. Przykład: zmieniono strukturę linków w „Ustawienia” → „Bezpośrednie odnośniki”, ale WordPress nie zaktualizował pliku .htaccess. W efekcie wszystkie podstrony, poza główną, mogą zwracać błąd 404. Jak to naprawić: Ręcznie zaktualizuj plik .htaccess lub po prostu kliknij „Zapisz zmiany” w ustawieniach bezpośrednich odnośników – to wymusi regenerację pliku .htaccess.

  1. Strona lub wpis został usunięty

Jeśli usunięto stronę/wpis, ale odnośniki do niej nadal istnieją (np. w menu, wynikach wyszukiwania lub na innych stronach), użytkownicy będą trafiać na 404.

  1. Uszkodzony lub usunięty plik .htaccess

Ten plik odpowiada za przetwarzanie adresów URL. Jeśli został usunięty lub uszkodzony, WordPress nie poradzi sobie z adresacją.

  1. Problemy z motywem lub wtyczkami

Błąd może pojawić się po instalacji/aktualizacji wtyczki (zwłaszcza obsługującej URL-e, niestandardowe typy wpisów itp.) lub przez błędy w pliku functions.php motywu.


Jak naprawić błąd 404 w WordPress

1. Odśwież ustawienia bezpośrednich odnośników

Przejdź do Panelu administracyjnego → Ustawienia → Bezpośrednie odnośniki → i kliknij „Zapisz zmiany” — nawet jeśli nic nie zmieniasz. To zaktualizuje strukturę i plik .htaccess.

2. Sprawdź plik .htaccess

Połącz się z serwerem przez FTP lub menedżer plików w panelu hostingowym. Plik .htaccess znajduje się w katalogu głównym WordPressa. Domyślna zawartość wygląda tak:

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress

Jeśli plik nie istnieje — utwórz go ręcznie z powyższą treścią. Upewnij się, że ma uprawnienia 644. Aby uzyskać więcej informacji na temat domyślnej struktury .htaccess w WordPress, zapoznaj się z tym artykułem.

3. Wyłącz podejrzane wtyczki

Jeśli błąd pojawił się po instalacji wtyczki — tymczasowo ją dezaktywuj. Jeśli używasz niestandardowych typów wpisów (np. produkty WooCommerce), sprawdź, czy wtyczka poprawnie rejestruje ścieżki.

4. Przełącz się na domyślny motyw

Czasem przyczyną błędu są błędy w szablonie. Włącz domyślny motyw WordPressa (np. Twenty Twenty-Four) i sprawdź, czy problem zniknął.

5. Włącz logowanie błędów

Dla celów debugowania można włączyć wyświetlanie błędów w WordPressie. W pliku wp-config.php dodaj linie:

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_LOG', true );

Po tym błędy będą zapisywane w pliku /wp-content/debug.log.

6. Sprawdź logi serwera

Jeśli korzystasz z FASTPANEL, wejdź w kartę strony → zakładka „Logi” → sprawdź „Dziennik dostępu backend” i „Dziennik dostępu frontend”. Dzięki temu dowiesz się, które adresy wywołują błędy 404 i skąd pochodzą żądania — pomoże to zlokalizować uszkodzone linki.


Jak uniknąć błędu 404 w przyszłości

  • Nie zmieniaj struktury linków bez wyraźnej potrzeby.

  • Skorzystaj z wtyczki Redirection, aby skonfigurować przekierowania 301.

  • Po usunięciu stron pamiętaj o aktualizacji menu i linków.

  • Regularnie sprawdzaj błędy 404 w Google Search Console.


Podsumowanie

Błąd 404 w WordPressie może być frustrujący, ale łatwy do rozwiązania. Najczęściej wystarczy ponowne zapisanie struktury linków lub edycja pliku .htaccess. Jeśli problem jest bardziej złożony, warto przejrzeć dziennik serwera lub plik debugowania.

Naprawiając błędy 404, poprawisz nie tylko komfort użytkowników, ale także pozycję swojej strony w wynikach wyszukiwania.

Przykłady .htaccess dla popularnych CMS: jak przywrócić domyślny plik

· 11 min aby przeczytać
Customer Care Engineer

domyślne-pliki-htaccess-przykłady-dla-WordPress-Joomla-Drupal-i-innych-CMS-z-fragmentami-kodu

Plik .htaccess to plik konfiguracyjny używany na serwerach WWW Apache do zarządzania ustawieniami strony bez konieczności dostępu do głównego pliku konfiguracyjnego serwera. Może być używany do włączania przekierowań, ograniczania dostępu, konfigurowania przyjaznych adresów URL, buforowania i nie tylko - bezpośrednio z katalogu głównego strony lub dowolnego z jej katalogów.

Wiele systemów CMS tworzy ten plik automatycznie po instalacji lub oferuje przykład w dystrybucji.

Jeśli pracujesz z hostingiem, zwłaszcza opartym na Apache, warto wiedzieć, jak wygląda domyślny plik .htaccess dla różnych CMS. To może pomóc:

  • Sprawdzić, czy wszystko działa poprawnie po instalacji;

  • Przywrócić plik, jeśli został przypadkowo usunięty;

  • Zrozumieć, jakie reguły system stosuje „prosto z pudełka”.


Gdzie znajduje się plik .htaccess

Plik .htaccess zazwyczaj znajduje się w katalogu głównym strony, na przykład:

/var/www/site.com/public_html/.htaccess

Jeśli plik nie istnieje (np. został przypadkowo usunięty), można go utworzyć ręcznie z nazwą .htaccess (nazwa musi zaczynać się od kropki, bez rozszerzenia).

Otwórz plik w edytorze tekstu (np. Notepad++ lub VS Code). 

warning

Nie używaj pakietów biurowych (takich jak MS Word) do edycji, ponieważ mogą one wstawiać ukryte znaki, które zakłócą działanie pliku.

Poniżej znajduje się zestawienie standardowych plików .htaccess, które są domyślnie używane w popularnych CMS. Przykłady te mogą się przydać, jeśli przypadkowo usunąłeś lub uszkodziłeś oryginalny plik .htaccess i potrzebujesz go przywrócić, aby strona działała poprawnie.


Wordpress

Domyślny .htaccess dla WordPress umożliwia działanie czystych adresów URL i zawiera podstawowe reguły przekierowań:

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress

Jeśli używasz multisite z subdomenami (np. site1.example.com, site2.example.com):

# BEGIN WordPress Multisite

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]



# Redirect for multisite (subdomains)

RewriteCond %{REQUEST_FILENAME} -f [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^ - [L]

RewriteRule ^(wp-(content|admin|includes).*) $1 [L]

RewriteRule ^(.*\.php)$ $1 [L]

RewriteRule . index.php [L]

</IfModule>

# END WordPress Multisite

Jeśli używasz multisite z podkatalogami (na przykład example.com/site1, example.com/site2):

# BEGIN WordPress Multisite

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]



# Redirect for multisite (subdirectories)

RewriteCond %{REQUEST_FILENAME} -f [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^ - [L]

RewriteRule . index.php [L]

</IfModule>

# END WordPress Multisite

Joomla 2.5-3

Joomla używa .htaccess do podstawowych zabezpieczeń i konfiguracji przyjaznych adresów:

##

# @package Joomla

# @copyright Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.

# @license GNU General Public License version 2 or later; see LICENSE.txt

##



##

# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!

#

# The line just below this section: 'Options +FollowSymLinks' may cause problems

# with some server configurations. It is required for use of mod_rewrite, but may already

# be set by your server administrator in a way that dissallows changing it in

# your .htaccess file. If using it causes your server to error out, comment it out (add # to

# beginning of line), reload your site in your browser and test your sef url's. If they work,

# it has been set by your server administrator and you do not need it set here.

##



## Can be commented out if causes errors, see notes above.

Options +FollowSymLinks



## Mod_rewrite in use.



RewriteEngine On



## Begin - Rewrite rules to block out some common exploits.

# If you experience problems on your site block out the operations listed below

# This attempts to block the most common type of exploit `attempts` to Joomla!

#

# Block out any script trying to base64_encode data within the URL.

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]

# Block out any script that includes a <script> tag in URL.

RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]

# Block out any script trying to set a PHP GLOBALS variable via URL.

RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

# Block out any script trying to modify a _REQUEST variable via URL.

RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})

# Return 403 Forbidden header and show the content of the root homepage

RewriteRule .* index.php [F]

#

## End - Rewrite rules to block out some common exploits.



## Begin - Custom redirects

#

# If you need to redirect some pages, or set a canonical non-www to

# www redirect (or vice versa), place that code here. Ensure those

# redirects use the correct RewriteRule syntax and the [R=301,L] flags.

#

## End - Custom redirects



##

# Uncomment following line if your webserver's URL

# is not directly related to physical file paths.

# Update Your Joomla! Directory (just / for root).

##



# RewriteBase /



## Begin - Joomla! core SEF Section.

#

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

#

# If the requested path and file is not /index.php and the request

# has not already been internally rewritten to the index.php script

RewriteCond %{REQUEST_URI} !^/index\.php

# and the request is for something within the component folder,

# or for the site root, or for an extensionless URL, or the

# requested URL ends with one of the listed extensions

RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]

# and the requested path and file doesn't directly match a physical file

RewriteCond %{REQUEST_FILENAME} !-f

# and the requested path and file doesn't directly match a physical folder

RewriteCond %{REQUEST_FILENAME} !-d

# internally rewrite the request to the index.php script

RewriteRule .* index.php [L]

#

## End - Joomla! core SEF Section.

Joomla 4-5

W pliku .htaccess Joomli 4 poświęcono więcej uwagi bezpieczeństwu i pamięci podręcznej:

##

# @package    Joomla

# @copyright  (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>

# @license    GNU General Public License version 2 or later; see LICENSE.txt

##



##

# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!

#

# The line 'Options +FollowSymLinks' may cause problems with some server configurations.

# It is required for the use of Apache mod_rewrite, but it may have already been set by

# your server administrator in a way that disallows changing it in this .htaccess file.

# If using it causes your site to produce an error, comment it out (add # to the

# beginning of the line), reload your site in your browser and test your sef urls. If

# they work, then it has been set by your server administrator and you do not need to

# set it here.

##



## MISSING CSS OR JAVASCRIPT ERRORS

#

# If your site looks strange after enabling this file, then your server is probably already

# gzipping css and js files and you should comment out the GZIP section of this file.

##



## OPENLITESPEED

#

# If you are using an OpenLiteSpeed web server then any changes made to this file will

# not take effect until you have restarted the web server.

##



## Can be commented out if causes errors, see notes above.

Options +FollowSymlinks

Options -Indexes



## No directory listings

<IfModule mod_autoindex.c>

IndexIgnore *

</IfModule>



## Suppress mime type detection in browsers for unknown types

<IfModule mod_headers.c>

Header always set X-Content-Type-Options "nosniff"

</IfModule>



## Protect against certain cross-origin requests. More information can be found here:

## https://developer.mozilla.org/en-US/docs/Web/HTTP/Cross-Origin_Resource_Policy_(CORP)

## https://web.dev/why-coop-coep/

#<IfModule mod_headers.c>

# Header always set Cross-Origin-Resource-Policy "same-origin"

# Header always set Cross-Origin-Embedder-Policy "require-corp"

#</IfModule>



## Disable inline JavaScript when directly opening SVG files or embedding them with the object-tag

<FilesMatch "\.svg$">

  <IfModule mod_headers.c>

    Header always set Content-Security-Policy "script-src 'none'"

  </IfModule>

</FilesMatch>



## These directives are only enabled if the Apache mod_rewrite module is enabled

<IfModule mod_rewrite.c>

RewriteEngine On



## Begin - Rewrite rules to block out some common exploits.

# If you experience problems on your site then comment out the operations listed

# below by adding a # to the beginning of the line.

# This attempts to block the most common type of exploit `attempts` on Joomla!

#

# Block any script trying to base64_encode data within the URL.

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]

# Block any script that includes a <script> tag in URL.

RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]

# Block any script trying to set a PHP GLOBALS variable via URL.

RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

# Block any script trying to modify a _REQUEST variable via URL.

RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})

# Return 403 Forbidden header and show the content of the root home page

RewriteRule .* index.php [F]

#

## End - Rewrite rules to block out some common exploits.



## Begin - Custom redirects

#

# If you need to redirect some pages, or set a canonical non-www to

# www redirect (or vice versa), place that code here. Ensure those

# redirects use the correct RewriteRule syntax and the [R=301,L] flags.

#

## End - Custom redirects



##

# Uncomment the following line if your webserver's URL

# is not directly related to physical file paths.

# Update Your Joomla! Directory (just / for root).

##



# RewriteBase /



## Begin - Joomla! core SEF Section.

#

# PHP FastCGI fix for HTTP Authorization, required for the API application

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# -- SEF URLs for the API application

# If the requested path starts with /api, the file is not /api/index.php

# and the request has not already been internally rewritten to the

# api/index.php script

RewriteCond %{REQUEST_URI} ^/api/

RewriteCond %{REQUEST_URI} !^/api/index\.php

# and the requested path and file doesn't directly match a physical file

RewriteCond %{REQUEST_FILENAME} !-f

# and the requested path and file doesn't directly match a physical folder

RewriteCond %{REQUEST_FILENAME} !-d

# internally rewrite the request to the /api/index.php script

RewriteRule .* api/index.php [L]

# -- SEF URLs for the public frontend application

# If the requested path and file is not /index.php and the request

# has not already been internally rewritten to the index.php script

RewriteCond %{REQUEST_URI} !^/index\.php

# and the requested path and file doesn't directly match a physical file

RewriteCond %{REQUEST_FILENAME} !-f

# and the requested path and file doesn't directly match a physical folder

RewriteCond %{REQUEST_FILENAME} !-d

# internally rewrite the request to the index.php script

RewriteRule .* index.php [L]

#

## End - Joomla! core SEF Section.

</IfModule>



## These directives are only enabled if the Apache mod_rewrite module is disabled

<IfModule !mod_rewrite.c>

<IfModule mod_alias.c>

# When Apache mod_rewrite is not available, we instruct a temporary redirect

# of the start page to the front controller explicitly so that the website

# and the generated links can still be used.

RedirectMatch 302 ^/$ /index.php/

# RedirectTemp cannot be used instead

</IfModule>

</IfModule>



## GZIP

## These directives are only enabled if the Apache mod_headers module is enabled.

## This section will check if a .gz file exists and if so will stream it

##     directly or fallback to gzip any asset on the fly

## If your site starts to look strange after enabling this file, and you see

##     ERR_CONTENT_DECODING_FAILED in your browser console network tab,

##     then your server is already gzipping css and js files and you don't need this

##     block enabled in your .htaccess

<IfModule mod_headers.c>

# Serve gzip compressed CSS files if they exist

# and the client accepts gzip.

RewriteCond "%{HTTP:Accept-encoding}" "gzip"

RewriteCond "%{REQUEST_FILENAME}\.gz" -s

RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]



# Serve gzip compressed JS files if they exist

# and the client accepts gzip.

RewriteCond "%{HTTP:Accept-encoding}" "gzip"

RewriteCond "%{REQUEST_FILENAME}\.gz" -s

RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]



# Serve correct content types, and prevent mod_deflate double gzip.

RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]

RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]



<FilesMatch "(\.js\.gz|\.css\.gz)$">

# Serve correct encoding type.

Header set Content-Encoding gzip



# Force proxies to cache gzipped &

# non-gzipped css/js files separately.

Header append Vary Accept-Encoding

</FilesMatch>

</IfModule>


Drupal 7

Plik .htaccess w Drupal 7 zawiera podstawową konfigurację zabezpieczeń i optymalizacji. Oto jego typowa zawartość:

# Use the following to prevent server signatures and directory browsing

ServerSignature Off

Options -Indexes



# Protect sensitive files

<FilesMatch "\.(htaccess|htpasswd)">

  Order Allow,Deny

  Deny from all

</FilesMatch>



# Protect files from being accessed directly

<FilesMatch "\.(txt|md|yml|json|xml)$">

  Order Allow,Deny

  Deny from all

</FilesMatch>



# Set a default timezone for PHP

SetEnv TZ Europe/Amsterdam



# Enable compression for better performance

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript



# Cache settings for better performance

<IfModule mod_headers.c>

  Header set Cache-Control "public, max-age=3600"

</IfModule>


Drupal 8

Dla Drupal 8 plik .htaccess zawiera już dodatkowe ulepszenia i obsługuje nowe funkcje. Na przykład: obsługa HTTP/2, zwiększone bezpieczeństwo, konfiguracja dla działania z clean URLs oraz z pamięcią podręczną.

# Prevent server signature and directory browsing

ServerSignature Off

Options -Indexes



# Protect sensitive files

<FilesMatch "\.(htaccess|htpasswd|ini|log|conf)$">

  Order Allow,Deny

  Deny from all

</FilesMatch>



# Clean URLs support

RewriteEngine on

RewriteBase /



# Support for HTTP/2

<IfModule http2_module>

  Protocols h2 http/1.1

</IfModule>



# Cache control for assets

<IfModule mod_headers.c>

  Header set Cache-Control "public, max-age=86400, s-maxage=86400, must-revalidate"

</IfModule>



# Enable compression

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript



# Redirect trailing slashes for clean URLs

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} /+$

RewriteRule ^(.*)/$ /$1 [R=301,L]

Drupal 9

Dla Drupal 9 plik .htaccess zawiera dodatkowe ulepszenia umożliwiające pracę z nowszymi technologiami internetowymi, takimi jak obsługa HTTP/2 oraz bardziej rygorystyczne środki bezpieczeństwa.

# Prevent directory browsing and server signatures

ServerSignature Off

Options -Indexes



# Protect sensitive files

<FilesMatch "\.(htaccess|htpasswd|ini|log|conf)$">

  Order Allow,Deny

  Deny from all

</FilesMatch>



# Enable clean URLs (this is essential for Drupal to work properly)

RewriteEngine on

RewriteBase /



# Support for HTTP/2 and modern caching

<IfModule mod_http2.c>

  Protocols h2 http/1.1

</IfModule>



<IfModule mod_headers.c>

  Header set Cache-Control "public, max-age=86400, s-maxage=86400, must-revalidate"

</IfModule>



# Enable Gzip compression

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript



# Clean URLs support for Drupal

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} /+$

RewriteRule ^(.*)/$ /$1 [R=301,L]

OpenCart

Options +FollowSymlinks

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Magento (2.x)

Magento posiada bardziej złożony plik .htaccess, który zawiera reguły dotyczące kompresji, pamięci podręcznej oraz zabezpieczeń. Przykład dla Magento 2:

<IfModule mod_php5.c>

php_flag memory_limit 756M

php_flag max_execution_time 18000

</IfModule>



<IfModule mod_rewrite.c>

Options +FollowSymLinks

RewriteEngine on



RewriteCond %{REQUEST_URI} !^/pub/

RewriteRule ^(.*)$ pub/$1 [L]

</IfModule>

PrestaShop (1.7.x)

PrestaShop automatycznie generuje plik .htaccess podczas instalacji lub przy zmianie ustawień przyjaznych adresów URL:

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

# .htaccess automatically generated by PrestaShop e-commerce open-source solution

# http://www.prestashop.com - http://www.prestashop.com/forums



<IfModule mod_rewrite.c>

<IfModule mod_env.c>

     SetEnv HTTP_MOD_REWRITE On

</IfModule>



RewriteEngine on



# Domain: www.example.com

RewriteRule . - [E=REWRITEBASE:/]



# API

RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]



# Images

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]

RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]

RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]

RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]



# AlphaImageLoader for IE and fancybox

RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]



# Dispatcher

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]

</IfModule>



<IfModule mod_headers.c>

<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">

     Header set Access-Control-Allow-Origin "*"

</FilesMatch>

</IfModule>



<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 week"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

ExpiresByType application/x-javascript "access plus 1 week"

ExpiresByType image/x-icon "access plus 1 year"

ExpiresByType image/svg+xml "access plus 1 year"

ExpiresByType image/vnd.microsoft.icon "access plus 1 year"

ExpiresByType application/font-woff "access plus 1 year"

ExpiresByType application/x-font-woff "access plus 1 year"

ExpiresByType font/woff2 "access plus 1 year"

ExpiresByType application/vnd.ms-fontobject "access plus 1 year"

ExpiresByType font/opentype "access plus 1 year"

ExpiresByType font/ttf "access plus 1 year"

ExpiresByType font/otf "access plus 1 year"

ExpiresByType application/x-font-ttf "access plus 1 year"

ExpiresByType application/x-font-otf "access plus 1 year"

</IfModule>



<IfModule mod_headers.c>

Header unset Etag

</IfModule>

FileETag none



<IfModule mod_deflate.c>

<IfModule mod_filter.c>

     AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript font/ttf application/x-font-ttf font/otf application/x-font-otf font/opentype image/svg+xml

</IfModule>

</IfModule>



# If rewrite mod isn't enabled

ErrorDocument 404 /index.php?controller=404



# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

# .htaccess automatically generated by PrestaShop e-commerce open-source solution

# http://www.prestashop.com - http://www.prestashop.com/forums



<IfModule mod_rewrite.c>

<IfModule mod_env.c>

     SetEnv HTTP_MOD_REWRITE On

</IfModule>



RewriteEngine on



# Domain: www.example.com

RewriteRule . - [E=REWRITEBASE:/]



# API

RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]



# Images

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]

RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]

RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]

RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]



# AlphaImageLoader for IE and fancybox

RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]



# Dispatcher

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]

</IfModule>



<IfModule mod_headers.c>

<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">

     Header set Access-Control-Allow-Origin "*"

</FilesMatch>

</IfModule>



<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 week"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

ExpiresByType application/x-javascript "access plus 1 week"

ExpiresByType image/x-icon "access plus 1 year"

ExpiresByType image/svg+xml "access plus 1 year"

ExpiresByType image/vnd.microsoft.icon "access plus 1 year"

ExpiresByType application/font-woff "access plus 1 year"

ExpiresByType application/x-font-woff "access plus 1 year"

ExpiresByType font/woff2 "access plus 1 year"

ExpiresByType application/vnd.ms-fontobject "access plus 1 year"

ExpiresByType font/opentype "access plus 1 year"

ExpiresByType font/ttf "access plus 1 year"

ExpiresByType font/otf "access plus 1 year"

ExpiresByType application/x-font-ttf "access plus 1 year"

ExpiresByType application/x-font-otf "access plus 1 year"

</IfModule>



<IfModule mod_headers.c>

Header unset Etag

</IfModule>

FileETag none



<IfModule mod_deflate.c>

<IfModule mod_filter.c>

     AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript font/ttf application/x-font-ttf font/otf application/x-font-otf font/opentype image/svg+xml

</IfModule>

</IfModule>



# If rewrite mod isn't enabled

ErrorDocument 404 /index.php?controller=404

Shopify, Squarespace, Adobe Commerce i inne platformy w chmurze

Shopify, Squarespace, Adobe Commerce (dawniej Magento Commerce) to platformy chmurowe, które nie zapewniają bezpośredniego dostępu do pliku .htaccess. Wszystkie ustawienia konfiguruje się za pomocą panelu administracyjnego.

Innymi przykładami takich usług są Wix, Weebly, BigCommerce i Jimdo. Te platformy umożliwiają użytkownikom tworzenie i optymalizację stron internetowych za pomocą wizualnych interfejsów, bez konieczności ręcznej edycji plików konfiguracyjnych serwera.

Potrzebujesz pomocy z plikiem .htaccess?

Jeśli nie masz pewności, z jakiego systemu CMS korzysta Twoja strona lub jak bezpiecznie przywrócić uszkodzony plik .htaccess, jesteśmy tu, aby Ci pomóc.

Wsparcie techniczne dla naszych klientów jest całkowicie bezpłatne i dostępne 24/7/365. Wystarczy, że utworzysz zgłoszenie, a nasz zespół szybko się Tobą zajmie.

Więcej informacji o zakresie pomocy znajdziesz w naszej polityce wsparcia.