简体   繁体   中英

301 Redirection not working on Query string URL

I wan't to redirect independently query string URL without affecting rest of redirection.

I used below code for that but it is not working.

Redirect 301 /contact/index.php?main_page=index&cPath=7/  https://www.abc.xyz/contact-us.php
Redirect 301 /contact/index.php?main_page=index&cPath=7   https://www.abc.xyz/contact-us.php

Also I used below 301 redirection but it is redirect to abc.xyz/page/2

Redirect 301 /tag/metal-roof/page/2/    https://www.abc.xyz/solar-power.php
Redirect 301 /tag/metal-roof/page/2     https://www.abc.xyz/solar-power.php

Redirect 301 /tag/metal-roof/   https://www.abc.xyz/
Redirect 301 /tag/metal-roof    https://www.abc.xyz/

Using Below code at least I am able to redirect to that page but not able to remove query string.

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^contact\/index\.php$ "https\:\/\/www\.abc\.xyz\/contact\-us\.php" [R=301,L]

After redirection URL look like:

https://www.abc.xyz/contact-us.php?main_page=index&cPath=7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM