LINUX.ORG.RU

ГУРУ .htaccess помоги!

 


0

1

Привет.
Надеюсь ты очень хорошо владеешь знаниями в настройке .htaccess
Очень нужна помощь.
Есть один скрипт в интернете клон сервиса витрин ссылок linkslot (1adlink). У всех все отлично работает.
НО У МЕНЯ НИ В КАКУЮ НЕ ХОЧЕТ РАБОТАТЬ!!!
Сначала поставил на свой VPS Debian 7 + nginx + apache2 - не работает rewrite как у всех.
Заказал новый VPS поставил чистый apache2 - все ровно не хочет работать.
Все сайты на этих двух VPS работают отлично, а этот нет.
Также проверил на хостинге hostinger.ru - тоже самое.

Суть .htaccess:
- убирает расширения .php из окончаний адреса
- добавляет слеш в конец
- отображает по адресу со слешем в конце (без расширения .php) содержание файла адрес.php

Что он у меня делает:
- перехожу по адрес/ и выдает
«The requested URL /reklamodatelu/ was not found on this server.»
- перехожу по адрес.php, перенаправляет на адрес/ и отображает
«The requested URL /reklamodatelu/ was not found on this server.»
Посмотрите, может тут хрень в .htaccess написана

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
 RewriteRule ^(.*)$ http://%1/$1 [R=301,L]


</IfModule>
AddDefaultCharset UTF-8
DirectoryIndex index.html index.shtml index.pl index.cgi index.php

# Запрещаем листинг директорий
Options -Indexes

# Отключаем вывод информации о сервере
ServerSignature Off
php_flag expose_php Off

<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
</IfModule>

# Не даем IE войти в режим совместимости с IE7, даже когда он сам этого хочет
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
                BrowserMatch MSIE ie
                Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
        </IfModule>
</IfModule>

<IfModule mod_expires.c>
 ExpiresActive on
 ExpiresDefault                          "access plus 1 month"
 ExpiresByType text/cache-manifest       "access plus 0 seconds"
 ExpiresByType text/html                 "access plus 0 seconds"
 ExpiresByType text/xml                  "access plus 0 seconds"
 ExpiresByType application/xml           "access plus 0 seconds"
 ExpiresByType application/json          "access plus 0 seconds"
 ExpiresByType application/rss+xml       "access plus 1 month"
 ExpiresByType image/x-icon              "access plus 1 week" 
 ExpiresByType image/gif                 "access plus 1 year"
 ExpiresByType image/png                 "access plus 1 year"
 ExpiresByType image/jpg                 "access plus 1 year"
 ExpiresByType image/jpeg                "access plus 1 year"
 ExpiresByType video/ogg                 "access plus 1 year"
 ExpiresByType audio/ogg                 "access plus 1 year"
 ExpiresByType audio/mp3                 "access plus 1 year"
 ExpiresByType video/mp4                 "access plus 1 year"
 ExpiresByType video/webm                "access plus 1 year"
 ExpiresByType text/x-component          "access plus 1 month"
 ExpiresByType font/truetype             "access plus 1 year"
 ExpiresByType font/opentype             "access plus 1 year"
 ExpiresByType application/x-font-woff   "access plus 1 year"
 ExpiresByType image/svg+xml             "access plus 1 month"
 ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
 ExpiresByType text/css                  "access plus 2 months"
 ExpiresByType application/javascript    "access plus 2 months"
 ExpiresByType text/javascript           "access plus 2 months"
 <IfModule mod_headers.c>
  Header append Cache-Control "public"
 </IfModule>
</IfModule>

<IfModule mod_headers.c>
 # указываем прокси-серверам передавать заголовок User-Agent
 # для корректного распознавания сжатия
 Header append Vary User-Agent env=!dont-vary
 # запрещаем кэширование на уровне прокси-сервера для всех
 # файлов, для которых у нас выставлено сжатие,
 <FilesMatch .*\.(css|js|php|phtml|shtml|html|xml)$>
   Header append Cache-Control: "private, must-revalidate"
 </FilesMatch>
</IfModule>

# Универсальный редирект с домена С www. на домен БEЗ www
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !=on
 RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
 RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

</IfModule>


<IfModule mod_rewrite.c>
 RewriteEngine On 
 RewriteBase /  

 # всё что не касается файлов и не имеет точки в названии, добавлять в конце слеш
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_URI} !(.*)\.(.*){1,5}$
 RewriteCond %{REQUEST_URI} !(.*)/$
 RewriteRule ^(.*[^/])$ $1/ [L,R=301]
 
 # делает редирект для  *.php)
 RewriteCond %{REQUEST_URI} ^(.*)\.php$
 RewriteRule ^(.*)\.php$ $1\/ [L,R=301]
 
 # убираем индексы
 RewriteCond %{REQUEST_URI} ^(.*)index.php(.*)$
 RewriteRule ^(.*)index.php(.*)$ $1$2 [L,R=301]
 
 # site.ru/*/ открывает как site.ru/*.php
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME}\.php -f
 RewriteRule ^(.*)(\/)$ %{REQUEST_FILENAME}.php/ [L]

</IfModule>

Заранее очень благоларен



Последнее исправление: pligin (всего исправлений: 1)

Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.