Forum

Thread tagged as: Question

301 redirect single URL with s= query string

Is it possible to 301 redirect a URL containing an s= query string to another URL containing s= query string?

For example, redirect: work-feature.php?s=old page title

to: work-feature.php?s=new page title

Thanks?

Tim Rex

Tim Rex 0 points

  • 7 years ago
Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Rex

Yes you can do that, but it would be in your .htaccess file so nothing to do with Perch.

In your .htaccess file, you would need to add this entry:

Redirect 301 work-feature.php?s=<old page title> work-feature.php?s=<new page title>

Hope that helps..

Tim Rex

Tim Rex 0 points

Hello there.

Thanks for the reply.

This is giving me an internal server error.

This is what I've added to the htaccess file:

Redirect 301 work-feature.php?s=teachermail-logo-brochure-website-design work-feature.php?s=parentmail-logo-brochure-website-design

This is the page I'm trying to redirect: https://www.trexdesign.co.uk/work-feature.php?s=teachermail-logo-brochure-website-design

Any ideas please?

Thanks again.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Internal Server Error isn't an error, more of a notification of an error. Check your apache error log.

Tim Rex

Tim Rex 0 points

Thanks Drew.

The error is 'Redirect to non-URL'.

Should the redirect entry contain the full URL?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you're missing a slash:

Redirect 301 work-feature.php?s=teachermail-logo-brochure-website-design /work-feature.php?s=parentmail-logo-brochure-website-design
Tim Rex

Tim Rex 0 points

Thanks. I'm not getting the error anymore, but the redirect isn't working, sorry.

https://www.trexdesign.co.uk/work-feature.php?s=teachermail-logo-brochure-website-design

Drew McLellan

Drew McLellan 2638 points
Perch Support

I might be wrong, but I don't think you can redirect based on query strings. At any rate, you may be better asking somewhere where they're qualified to help.