Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Chcę skonfigurować "Przyjazne URL'e" w PrestaShop. Wiem, że na necie jest wiele linków jak to zrobić, tak też postępowałem. Niestety nie działa mi to.
Mianowicie:
Apache Version Apache/2.2.22 (Debian)
Loaded Modules core mod_log_config mod_logio mod_version prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation sapi_apache2 mod_reqtimeout [b]mod_rewrite[/b] mod_setenvif mod_status[/quote]
Link po włączeniu opcji "Przyjaznych URL'i":http://localhost/shops/presta/prestashop/muzyczne-ipod/1-ipod-nano.html[/quote]
A strona się nie wyświetla:Not Found
The requested URL /shops/presta/prestashop/muzyczne-ipod/1-ipod-nano.html was not found on this server.
Apache/2.2.22 (Debian) Server at localhost Port 80[/quote]
Mój plik .htaccess:Kod:
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again # .htaccess automaticaly 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> # Disable Multiviews Options -Multiviews RewriteEngine on RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule . - [E=REWRITEBASE:/shops/presta/prestashop/] RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L] # Images RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L] RewriteCond %{HTTP_HOST} ^localhost$ 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] RewriteCond %{HTTP_HOST} ^localhost$ 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] RewriteCond %{HTTP_HOST} ^localhost$ 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] RewriteCond %{HTTP_HOST} ^localhost$ 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] RewriteCond %{HTTP_HOST} ^localhost$ 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] RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^([0-9])([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/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L] RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L] # AlphaImageLoader for IE and fancybox RewriteCond %{HTTP_HOST} ^localhost$ 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 RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^.*$ - [NC,L] RewriteCond %{HTTP_HOST} ^localhost$ RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L] </IfModule> #If rewrite mod isn't enabled ErrorDocument 404 /shops/presta/prestashop/index.php?controller=404 # ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated againWiem, że to nie forum PrestaShop, ale jest tu wielu ludzi z ogromną wiedzą, więc liczę na to, że ktoś coś podpowie ;)
Offline
Sugerowałbym nie dawać ich docelowo do htacces, ale zainkludować w konfigu vhosta.
Apache parsuje od nowa htacces przy każdym wejściu do katalogu, co powoduje dłuższą odpowiedź serwera.
W konfigu vhosta musisz reguły obudować oznaczeniem lokalizacji Directory,
ale chodzi to dużo sprawniej potem.
Przykład:
<Directory /gdzie/siedzi/presta/shop> #tu wkleić bądź zainkludować reguły, np: include /moje/zajebiste/reguly/rewrite.conf </Directory>
Offline
Na początek:
# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost 127.0.1.1 debian.example.com debian 127.0.0.1 presta.local # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
# cat /etc/apache2/sites-available/presta
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName presta.local DocumentRoot /var/www/shops/presta/prestashop <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/shops/presta/prestashops/> Options -Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Skrypty mam w folderze:
/var/www/shops/presta/prestashop
A index.php dostępny po wpisaniu w przeglądarce:
http://presta.local/shops/presta/prestashop/
Offline
Time (s) | Query |
---|---|
0.00014 | SET CHARSET latin2 |
0.00007 | SET NAMES latin2 |
0.00211 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='3.135.206.166' WHERE u.id=1 |
0.00137 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.135.206.166', 1732488602) |
0.00073 | SELECT * FROM punbb_online WHERE logged<1732488302 |
0.00114 | DELETE FROM punbb_online WHERE ident='18.219.253.199' |
0.00080 | SELECT topic_id FROM punbb_posts WHERE id=246965 |
0.00137 | SELECT id FROM punbb_posts WHERE topic_id=24708 ORDER BY posted |
0.00090 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=24708 AND t.moved_to IS NULL |
0.00006 | SELECT search_for, replace_with FROM punbb_censoring |
0.00107 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=24708 ORDER BY p.id LIMIT 0,25 |
0.00147 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=24708 |
Total query time: 0.01123 s |