D
D
Dmitry2014-07-02 16:29:15
Access rights
Dmitry, 2014-07-02 16:29:15

How to make an htaccess redirect?

Hello!
Tell me how to implement a redirect, I tried for some reason it does not work!
Here is an example I tried:

RewriteRule ^index1.php?id=29 /model_a1_2/ [L,R=301]


and tried like this:

RewriteRule ^index1.php\?id=29 /model_a1_2 [L,R=301]


I will be very grateful if you help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dedmarazmon, 2014-07-02
@dedmarazmon

Try
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site\.com$ [NC]
RewriteRule ^(.*)$ http: //site.com/$1 [R=301,L]
RewriteRule ^index1.php?id=29 http : //site.com/model_a1_2 [R=301,L]

O
Oleg Krasnov, 2014-07-02
@OKrasnov

The question mark is a separator between URL and parameters, and is not part of the URL that mod_rewrite works with.
RewriteCond %{QUERY_STRING} ^id=29$
RewriteRule ^index1.php$ /model_a1_2? [R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question