0

I'd like to redirect the URL's

https://old-URL.com/index.php?topic={integers} to https://new-URL.com/index.php?topic={integers}

I've tried:

RewriteEngine On    
RewriteRule ^\/index\.php\?topic=(.*) https://new-URL.com/ [R=301]

But I can't seem to get it for the life of me.

1 Answer 1

2

You can not match against URL QueryString ( ?topic=val ) in pattern of a RewriteRule. You need to use RewriteCond for that .

RewriteEngine on

RewriteCond %{QUERY_STRING} ^topic=(.+)$ [NC]
RewriteRule ^index.php$ http://newurl.com/index.php?topic=%1 [L,R,NE]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.