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!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2013-11-28 11:03:16

  kondzio14 - Użytkownik

kondzio14
Użytkownik
Zarejestrowany: 2008-02-14

Apache2 - mod_rewrite

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 mod_rewrite mod_setenvif mod_status

Link po włączeniu opcji "Przyjaznych URL'i":

http://localhost/shops/presta/prestashop/muzyczne-ipod/1-ipod-nano.html

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

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 again

Wiem, że to nie forum PrestaShop, ale jest tu wielu ludzi z ogromną wiedzą, więc liczę na to, że ktoś coś podpowie ;)

Offline

 

#2  2013-11-28 13:28:34

  milyges - inż.

milyges
inż.
Skąd: Gorlice/Kraków
Zarejestrowany: 2006-04-09
Serwis

Re: Apache2 - mod_rewrite

Masz AllowOverride na tym katalogu ustawione na co? Pokaż konfigurację vhosta.

Offline

 

#3  2013-11-28 13:36:33

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/random
Zarejestrowany: 2008-01-07

Re: Apache2 - mod_rewrite

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:

Kod:

<Directory /gdzie/siedzi/presta/shop>
#tu wkleić bądź zainkludować reguły, np:
include /moje/zajebiste/reguly/rewrite.conf
</Directory>

W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#4  2013-11-29 21:36:36

  kondzio14 - Użytkownik

kondzio14
Użytkownik
Zarejestrowany: 2008-02-14

Re: Apache2 - mod_rewrite

Na początek:

# cat /etc/hosts

Kod:

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

Kod:

<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:

Kod:

/var/www/shops/presta/prestashop

A index.php dostępny po wpisaniu w przeglądarce:

Kod:

http://presta.local/shops/presta/prestashop/

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
To nie jest tylko forum, to nasza mała ojczyzna ;-)