Конфликт 301 редиректа и 404 ошибки

D
На сайте с 13.05.2015
Offline
83
525

Добрый день всем!

Уже больше суток ищу решение для своей проблемы, но пока безрезультатно.

Есть сайт: angora.com.ua

Когда добавляю в .htaccess 301 редирект с www на без и c index.php на без него, перестает работать 404 ошибка. Когда вводишь несуществ. адрес, переадресовует на главную либо просто на текущую страницу. А сервак вообще выдает 302.

Убираю редирект и все без проблем работает. Как решить вопрос?

Спасибо!

З.Ы. Сайт на самописе

J
На сайте с 20.02.2014
Offline
120
jkm
#1

Можете показать содержимое .htaccess?

D
На сайте с 13.05.2015
Offline
83
#2

ErrorDocument 404 /page404.html

DirectoryIndex index.php index.html

RewriteEngine On

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP

RewriteRule ^index\.php$ http://angora.com.ua/ [R=301,L]

RewriteCond %{HTTP_HOST} ^www.angora\.com.ua$ [NC]

RewriteRule ^(.*)$ http://angora.com.ua/$1 [R=301,L]

#Page

RewriteRule ^page/cart http://%{HTTP_HOST}/cart

RewriteRule ^page/(\w+)/?$ index.php?view=page&path=$1

RewriteRule ^page=(\d+)/?$ index.php?view=hits&page=$1

RewriteRule ^page http://%{HTTP_HOST}

#Hits/New/Sale

RewriteRule ^(hits|new|sale)/?$ index.php?view=$1

RewriteRule ^(hits|new|sale)/page=(\d+)?/?$ index.php?view=$1&page=$2

#Cetegory new

RewriteRule ^category/(\d+)/?$ index.php?view=cat&category=$1

RewriteRule ^category/(\d+)/sub/(\d+)/?$ index.php?view=cat&category=$1&sub=$2

RewriteRule ^category/(\d+)/page=(\d+)?/?$ index.php?view=cat&category=$1&page=$2

RewriteRule ^category/(\d+)/sub/(\d+)/page=(\d+)?/?$ index.php?view=cat&category=$1&sub=$2&page=$3

RewriteRule ^category/(\d+)/order/([a-z]+)/page=(\d+)?/?$ index.php?view=cat&category=$1&order=$2&page=$3

RewriteRule ^category/(\d+)/sub/(\d+)/order/([a-z]+)/page=(\d+)?/?$ index.php?view=cat&category=$1&sub=$2&order=$3&page=$4

RewriteRule ^category http://%{HTTP_HOST}

#Brands

RewriteRule ^brands/([-\w]+)/?$ index.php?view=brands&brand=$1

RewriteRule ^brands/([-\w]+)/page=(\d+)?/?$ index.php?view=brands&brand=$1&page=$2

RewriteRule ^brands/([-\w]+)/order/([-\w]+)/page=(\d+)?/?$ index.php?view=brands&brand=$1&order=$2&page=$3

#News ЧПУ

RewriteRule ^news/(\d+)|news/(\d+)_(\w+)/?$ index.php?view=news&news_id=$1

#Archive

RewriteRule ^archive/?$ index.php?view=archive

RewriteRule ^archive/page=(\d+)?/?$ index.php?view=archive&page=$1

#Informer ЧПУ

RewriteRule ^informer/(\d+)|informer/(\d+)_(\w+)/?$ index.php?view=informer&informer_id=$1

RewriteRule ^informer http://%{HTTP_HOST}

#Product ЧПУ

RewriteRule ^product/(\d+)|product/(\d+)_(\w+)/?$ index.php?view=product&goods_id=$1

RewriteRule ^product http://%{HTTP_HOST}

#AddToCart

RewriteRule ^addtocart/(\d+)/?$ index.php?view=addtocart&goods_id=$1

#Reg

RewriteRule ^reg/?$ index.php?view=reg

#Cart

RewriteRule ^cart/?$ index.php?view=cart

RewriteRule ^cart/qty=(\d+)/id=(\d+)/?$ index.php?view=cart&qty=$1&id=$2

# gzip

<ifModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript

AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml

</ifModule>

<IfModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$

mod_gzip_item_include mime ^text\.*

mod_gzip_item_include mime ^application/x-javascript.*

mod_gzip_item_exclude mime ^image\.*

mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

</IfModule>

<ifModule mod_expires.c>

# Add correct content-type for fonts

AddType application/vnd.ms-fontobject .eot

AddType application/x-font-ttf .ttf

AddType application/x-font-opentype .otf

AddType application/x-font-woff .woff

AddType image/svg+xml .svg

# Compress compressible fonts

AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml

ExpiresActive On

ExpiresDefault "access plus 2592000 seconds"

ExpiresByType image/x-icon "access plus 2592000 seconds"

ExpiresByType image/jpeg "access plus 2592000 seconds"

ExpiresByType image/png "access plus 2592000 seconds"

ExpiresByType image/gif "access plus 2592000 seconds"

ExpiresByType application/x-font-ttf "access plus 2592000 seconds"

ExpiresByType application/x-woff "access plus 2592000 seconds"

ExpiresByType application/vnd.ms-fontobject "access plus 2592000 seconds"

ExpiresByType image/svg+xml "access plus 2592000 seconds"

ExpiresByType application/x-font-opentype "access plus 2592000 seconds"

ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"

ExpiresByType text/css "access plus 604800 seconds"

ExpiresByType text/javascript "access plus 2592000 seconds"

ExpiresByType application/javascript "access plus 2592000 seconds"

ExpiresByType application/x-javascript "access plus 2592000 seconds"

ExpiresByType text/html "access plus 600 seconds"

ExpiresByType application/xhtml+xml "access plus 600 seconds"

</ifModule>

M
На сайте с 04.12.2013
Offline
223
#3

Может, вот это правило срабатывает:

RewriteRule ^page http://%{HTTP_HOST}

Домены и скрипт для коротких ссылок: https://u75.ru/domains-for-shortcuts
D
На сайте с 13.05.2015
Offline
83
#4

miketomlin, Спасибо огромное!! Все получилось когда убрал строки!!)

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий