M
M
Maxim2014-01-10 13:20:03
Apache HTTP Server
Maxim, 2014-01-10 13:20:03

Why does .htaccess redirect give 404?

There is a correctly working redirect from the pages
www.domain.ru/advert.php?id=11 to www.domain.ru/advert/11

RewriteCond %{THE_REQUEST} advert\.php\?id=([0-9]+)\ HTTP/
RewriteRule ^advert\.php$ http://www.domain.ru/advert/%1? [R=301,L]

I'm trying to set up the same redirect
from www.domain.ru/index.php?mod=smth to www.domain.ru/smth
RewriteCond %{THE_REQUEST} index\.php\?mod=daily\ HTTP/
RewriteRule ^index\.php$ http://www.domain.ru/daily_rent? [R=301,L]

-- redirects correctly (www.domain.ru/daily_rent) but gives a 404 error, what could be the reason?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim, 2014-01-11
@go3l337

Solution:
K in addition to the redirect

RewriteCond %{THE_REQUEST} index\.php\?mod=smth\ HTTP/
RewriteRule ^index\.php$ http://www.domain.ru/smth? [R=301,L]

I should have added this rule
RewriteRule ^smth/?$ /index.php?mod=smth[QSA,L]

S
Stepan, 2014-01-10
@L3n1n

www.domain.ru/index.php?mod=daily what does it show?
More precisely, how strange you described the problem.
You need

from www.domain.ru/index.php?mod=smth to www.domain.ru/smth

But before writing redirects, you need to
www.domain.ru/smth
such a page exists

P
pechenov, 2014-01-10
@pechenov

What does www.domain.ru/index.php?mod=daily show?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question