R
R
realfront2017-02-27 16:05:53
Apache HTTP Server
realfront, 2017-02-27 16:05:53

Setting up htaccess 404 error. How to do it right?

There is something like this in the url: site.ru/news.php?id=1
And I want it to be site.ru/news/1
I wrote the following
RewriteRule ^news/([^/]+)/?$ news .php?id=$1
Everything works, but when you go to the site.ru/news.php link, it goes to site.ru/news and a 404 error is issued
How to register another redirect from site.ru/news.php?id=1 to site .ru/news/1
and from site.ru/news.php to site.ru/news

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2017-02-28
@shambler81

# 301 --- http://www.mydefile.ru/company/?a=47071 => http://www.mydefile.ru/about/
RewriteCond %{QUERY_STRING} (^|&)a=47071($|&)
RewriteRule ^company/$ /about/? [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question