1

I'm using this htaccess code to redirect my https terrafic to http when we using this simple code to do this redirect,every things fine but it break sites search engine link.the site have visitor from google to this link domain.com/search/?q=jim and convert it to domain.com/search/?q= and jim keyword is losting.

RewriteEngine on
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
RewriteRule ^news/(.*)/?$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
RewriteRule ^not-found$ notfound.php [G,L]
RewriteRule ^rss.xml$ rss.php
RewriteRule ^lasttagmap.xml$ lasttagmap.php
RewriteRule ^randtagmap.xml$ randtagmap.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php
Options +FollowSymLinks


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

1 Answer 1

0

This should happen for similar, other requests as well. As an example if you access /source/x/y?value=something the last bit should be lost. Your missing the query string.

The documentation would indicate you need to add a [QSA] Flag to the rewrites. The question Mod_rewrite: Include query string when redirecting would also suggest it.

2
  • thanks for your answer.can you suggest me right rule? Commented Nov 23, 2016 at 9:38
  • Did you read either the documentation or the other question? It should be sufficient to add the flag.
    – Seth
    Commented Nov 23, 2016 at 9:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .