Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> htaccess + mod_rewrite błąd składni?
Zumi
post
Post #1





Grupa: Zarejestrowani
Postów: 38
Pomógł: 0
Dołączył: 15.06.2008

Ostrzeżenie: (0%)
-----


Witam,
mam dużą prośbe o pomoc 2 sprawy

1.
Kod
### BEZ KONCOWEK *.html ###
RewriteEngine On
RewriteRule ^index.html$ /index [L,R=301]
RewriteRule ^([a-z-9-_]+)/index.html$ /$1/index [L,R=301]



kawałek kodu z pliku .htaccess dlaczego jeśli wpisze

www.photopaterek.pl/index wyskakuje mi wielokrotny wybór? lub

http://photopaterek.pl/images/picture/Ludz...ople/slides/007

jeśli dobrze sie domyslam z kodu to powinno działac przynajmniej dla plików index ale jak zrobić aby działało dla indexów jak i pozostałych?


2.
Kod
RewriteEngine On
RewriteRule ^Skrzynia...Box/([a-z0-9-_]+).html$ /images/picture/Skrzynia...Box/slides/$1.html [L,R=301]


całe portfolio jest zrobione na plikach html i chciałbym aby w linkach nie pokazywały się pełne ściezki dostepu dlaczego powyższy kod nie działa?


podaję tez całą zawartość pliku htaccess bo moze jedno z drugim sie dryzie...




Kod
### BEZ KONCOWEK *.html ###
RewriteEngine On
RewriteRule ^index.html$ /index [L,R=301]
RewriteRule ^([a-z-9-_]+)/index.html$ /$1/index [L,R=301]

RewriteEngine On
RewriteRule ^Skrzynia...Box/([a-z0-9-_]+).html$ /images/picture/Skrzynia...Box/slides/$1.html [L,R=301]



#
# WYMUSZONY SLASH
#

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]


#
# STANDARDY
#

AddDefaultCharset iso-8859-2

#
# REMOVE LAST-MODIFIED HEADER
#

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header unset Last-Modified
</FilesMatch>


#
# LINK BEZ WWW
#

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.photopaterek.pl(.*) [NC]
RewriteRule ^(.*)$ http://photopaterek.pl/$1 [R=301,L]

#
#USTAWIENIA CACHE STRONY
#

<IfModule mod_headers.c>
<FilesMatch "\.(gif)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(png)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(psd)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(ico)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(jpg)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(jpeg)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(swf)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(flv)$">
   Header set Cache-Control "max-age=7257600, public"
</FilesMatch>
<FilesMatch "\.(js)$">
   Header set Cache-Control "max-age=14515200, public"
</FilesMatch>
<FilesMatch "\.(css)$">
   Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\.(html)$">
   Header set Cache-Control "max-age=10800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(htm)$">
   Header set Cache-Control "max-age=10800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(txt)$">
   Header set Cache-Control "max-age=10800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(shtml)$">
   Header set Cache-Control "max-age=10800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(txt)$">
   Header set Cache-Control "max-age=10800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(xml)$">
   Header set Cache-Control "max-age=10800, public, must-revalidate"
</FilesMatch>
<FilesMatch "\.(pdf)$">
   Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\.(swf)$">
   Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</IfModule>

#
# STRONY BLEDOW HTTP
#

ErrorDocument 400 http://photopaterek.pl/400.html
ErrorDocument 401 http://photopaterek.pl/401.html
ErrorDocument 403 http://photopaterek.pl/403.html
ErrorDocument 404 http://photopaterek.pl/404.html
ErrorDocument 500 http://photopaterek.pl/500.html


gorąco prosze o pomoc

Ten post edytował Zumi 31.08.2010, 18:09:27
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
AdIoS_Neo
post
Post #2





Grupa: Zarejestrowani
Postów: 159
Pomógł: 43
Dołączył: 8.03.2009

Ostrzeżenie: (0%)
-----


A pousuwałeś flagi R tak jak erix pisał ? W tym .htaccess masz zdublowane
Kod
<FilesMatch "\.(txt)$">

Tu nie powinno być / na początku adresów na które przepisujesz:
Kod
RewriteEngine On
RewriteRule ^index$ index.html [L]
RewriteRule ^([[:print:]]+)/index$ $1/index.html [L]

btw. po co przed każdą komendą przepisania maszRewriteEngine On ?

edit: zapomniałem, ten wielokropek ... działa, bo znak kropki mieści się w zbiorze dowolnego znaku, ale będzie też dopasowywało np.:
SkrzyniaLOLBox

Ten post edytował AdIoS_Neo 3.09.2010, 13:58:32
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 10.06.2026 - 11:12