Поиск:

Ответ в темуСоздание новой темы Создание опроса
> mod_rewrite и небольшие трудности 
:(
    Опции темы
awers
  Дата 24.9.2007, 10:13 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Участник
Сообщений: 1465
Регистрация: 22.3.2006
Где: Россия, Таганрог

Репутация: 1
Всего: 31



Добрый день!

Уже замучался. Есть .htaccess :

Код

RewriteEngine on
Options +FollowSymlinks

RewriteBase /

RewriteCond %{REQUEST_URI} !^/(images/)
RewriteCond %{REQUEST_URI} \.(gif|jpg|png)
RewriteRule /(.*)/(.*)$ images/$1/$2 [L,QSA]

RewriteCond %{REQUEST_URI} \.(css)
RewriteRule /(.*)$ templates/$1 [L,QSA]

RewriteCond %{REQUEST_URI} !^/(admin/|images/)
RewriteCond %{REQUEST_URI} !\.(js|css|txt|inc|incx|gif|jpg)
RewriteRule ^(.*)$ index.php?$1 [L,QSA]


Все ссылки вида http://mysite.ru/module/view/page/item

Шаблоны CSS, XSLT одни на все страницы и для всех модулей. 
Проблема заключается в отображении картинок, как видно из кода: 
Код

RewriteCond %{REQUEST_URI} !^/(images/)
RewriteCond %{REQUEST_URI} \.(gif|jpg|png)
RewriteRule /(.*)/(.*)$ images/$1/$2 [L,QSA]

RewriteCond %{REQUEST_URI} \.(css)
RewriteRule /(.*)$ templates/$1 [L,QSA]


у меня есть директории
 http://mysite.ru/images
 http://mysite.ru/images/style/*.gif

в css ссылки на style/myimg.gif

в итоге картинки отображаются только на уровнях:
http://mysite.ru
http://mysite.ru/module/
http://mysite.ru/module/view

А дальше нет :(

Что делать? 
PM MAIL WWW ICQ Skype   Вверх
ZeeLax
Дата 24.9.2007, 10:15 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
****


Профиль
Группа: Модератор
Сообщений: 4388
Регистрация: 20.8.2006
Где: Алма-Ата

Репутация: 2
Всего: 88



Читать логи, для начала.


--------------------
Utility is when you have one telephone, luxury is when you have two, opulence is when you have three — and paradise is when you have none.
— Doug Larson
PM MAIL WWW ICQ Skype Jabber   Вверх
awers
Дата 24.9.2007, 11:42 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Участник
Сообщений: 1465
Регистрация: 22.3.2006
Где: Россия, Таганрог

Репутация: 1
Всего: 31



Код

[Mon Sep 24 12:50:50 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/templates/log2.jpg, referer: http://stvk/
[Mon Sep 24 12:50:56 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/templates/log2.jpg, referer: http://stvk/
[Mon Sep 24 12:51:02 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/templates/log2.jpg, referer: http://stvk/main/
[Mon Sep 24 12:51:40 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/templates/log2.jpg, referer: http://stvk/main/
[Mon Sep 24 12:52:04 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/main, referer: http://stvk/main/
[Mon Sep 24 12:52:04 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css/log2.jpg, referer: http://stvk/main/
[Mon Sep 24 12:52:05 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/main, referer: http://stvk/main/
[Mon Sep 24 12:52:05 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css/log2.jpg, referer: http://stvk/main/
[Mon Sep 24 12:52:41 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/templates/log2.jpg, referer: http://stvk/main/
[Mon Sep 24 12:52:58 2007] [error] [client 127.0.0.1] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary., referer: http://stvk/main/web_design/
[Mon Sep 24 12:52:58 2007] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://stvk/main/web_design/
[Mon Sep 24 12:52:58 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/templates/log2.jpg, referer: http://stvk/main/web_design/


PM MAIL WWW ICQ Skype   Вверх
awers
Дата 24.9.2007, 12:35 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Участник
Сообщений: 1465
Регистрация: 22.3.2006
Где: Россия, Таганрог

Репутация: 1
Всего: 31



Теперь переписал так:
Код

RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_URI} !(templates/)
RewriteCond %{REQUEST_URI} \.(css)$
RewriteRule ^(.+)/(.*)$ templates/$2 [L,QSA]

RewriteCond %{REQUEST_URI} !(images/)
RewriteCond %{REQUEST_URI} \.(jpg|gif|png)$
RewriteRule ^(.+)/(.*)/(.*)\.(jpg|gif|png)$ images/$2/$3.$4  [L,QSA]


RewriteCond %{REQUEST_URI} !^/(admin/|images/)
RewriteCond %{REQUEST_URI} !\.(js|css|txt|inc|incx|gif|jpg)
RewriteRule ^(.*)$ index.php?$1  [L,QSA]


условия для стилей и картинок (http://mysite.ru/module/style/1.jpg или http://mysite.ru/main/my.css)
работают на любом уровне (http://mysite.ru/module/view/blah/blah/1.css) кроме корневого (http://mysite.ru/1.css и http://mysite.ru/module)

Уже мозг болит :(

Ну собстно логи:
Код

[Mon Sep 24 13:41:29 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css, referer: http://stvk/main
[Mon Sep 24 13:41:29 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style, referer: http://stvk/main
[Mon Sep 24 13:41:38 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css, referer: http://stvk/main
[Mon Sep 24 13:41:38 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style, referer: http://stvk/main
[Mon Sep 24 13:43:32 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css, referer: http://stvk/main
[Mon Sep 24 13:43:32 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style, referer: http://stvk/main
[Mon Sep 24 13:43:33 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css, referer: http://stvk/main
[Mon Sep 24 13:43:33 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style, referer: http://stvk/main
[Mon Sep 24 13:43:46 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style, referer: http://stvk/main
[Mon Sep 24 13:43:47 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style, referer: http://stvk/main
[Mon Sep 24 13:43:47 2007] [error] [client 127.0.0.1] File does not exist: Z:/home/stvk/www/style.css, referer: http://stvk/main


Это сообщение отредактировал(а) awers - 24.9.2007, 12:36
PM MAIL WWW ICQ Skype   Вверх
awers
Дата 24.9.2007, 12:56 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Участник
Сообщений: 1465
Регистрация: 22.3.2006
Где: Россия, Таганрог

Репутация: 1
Всего: 31



Собственно добился работоспособности, а можно сделать изящнее?
Код

RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_URI} !(templates/)
RewriteCond %{REQUEST_URI} ^(.*)/(.*)\.(css)$
RewriteRule ^(.*)/(.*)$ templates/$2 [L,QSA]

RewriteCond %{REQUEST_URI} !(templates/)
RewriteCond %{REQUEST_URI} ^(.*)\.(css)$
RewriteRule ^(.*)$ templates/$1 [L,QSA]

RewriteCond %{REQUEST_URI} !(images/)
RewriteCond %{REQUEST_URI} ^(.+)/(.*)/(.*)\.(jpg|gif|png)$
RewriteRule ^(.+)/(.*)/(.*)\.(jpg|gif|png)$ images/$2/$3.$4  [L,QSA]

RewriteCond %{REQUEST_URI} !(images/)
RewriteCond %{REQUEST_URI} ^(.*)/(.*)\.(jpg|gif|png)$
RewriteRule ^(.*)/(.*)\.(jpg|gif|png)$ images/$1/$2.$3  [L,QSA]

RewriteCond %{REQUEST_URI} !^/(admin/|images/)
RewriteCond %{REQUEST_URI} !\.(js|css|txt|inc|incx|gif|jpg)
RewriteRule ^(.*)$ index.php?$1  [L,QSA]

PM MAIL WWW ICQ Skype   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Администрирование Web серверов и Web служб | Следующая тема »


 




[ Время генерации скрипта: 0.0807 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.