Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [inne] ModRewrite i problem z obrazkami, linkami
Turson
post
Post #1





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

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


Napisałem skrypt bloga (pewnie dam niedługo do oceny) i przyszedł czas na .htaccess

Wystrugałem taki kod:
Kod
RewriteEngine On
RewriteBase /blog/
RewriteRule ^.+(images/.+)$ $1 [L]
RewriteRule ^.+(js/.+)$ $1 [L]
RewriteRule ^.+(scripts/.+)$ $1 [L]
RewriteRule ^.+(style.css)$ $1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
RewriteRule ^(.*)/(.*),(.*).html$ artykul.php?kat=$1&id=$3&title=$2 [NC]
RewriteRule ^kategoria/(.*)/(.*)$ kategoria.php?id=$1&name=$2 [NC]
RewriteRule ^(.*)$ index.php?page=$1 [NC]


Struktura na serwerze jest następująca:
public_html/domena/blog
i w tym:
-images
-includes
- i inne podfoldery


Problem pojawił się przy stylach i linkach.
Nie ładują się żadne obrazki.
Oto index.php
  1. <link rel="stylesheet" href="blog/style.css" type="text/css">


Ok, poradziłem sobie.

Rozwiązanie .htaccess:
Kod
RewriteEngine On
RewriteRule ^(.*)/(.*),(.*).html$ artykul.php?kat=$1&id=$3&title=$2 [NC]
RewriteRule ^kategoria/(.*)/(.*)$ kategoria.php?id=$1&name=$2 [NC]
RewriteRule ^(.*).html$ index.php?page=$1 [NC]

a wszędzie trzeba podać adres bezwzględny

Ten post edytował Turson 21.09.2013, 15:18:19
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 19.08.2025 - 17:10