Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

.htaccess redirect help

Posted on 2011-04-19
4
Medium Priority
?
356 Views
Last Modified: 2012-05-11
Hi,

I want to redirect

http://www.domain.com/products_display.php?tkey=475
to
http://www.domain.com/products/

I have tried loads of variations but cant find one that works.

Thanks, Joe
0
Comment
Question by:joe90kane
  • 2
4 Comments
 
LVL 9

Expert Comment

by:x3man
ID: 35423223
I presume that you tried:

//301 Redirect Old File
Redirect 301 http://www.domain.com/products_display.php?tkey=475 http://www.domain.com/products/

from http://www.htaccessredirect.net/index.php
0
 
LVL 1

Author Comment

by:joe90kane
ID: 35423268
Yep doesnt work

That works when redirecting a .html page but not the ?tkey=475
0
 
LVL 2

Accepted Solution

by:
aliganjei earned 2000 total points
ID: 35427590
create a file named .htaccess in the directory containing following lines:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^tkey\=475$
RewriteRule ^products_display\.php$ /products

mod_rewrite is a very powerful tool to perform virtually any kind of url manipulation. Please take attention that you can not use Query_string directly in your RewriteRule. Instead you have to use RewriteCond as shown in the example
RewriteEngine On
RewriteCond %{QUERY_STRING} ^tkey\=475$
RewriteRule ^products_display\.php$ /products

Open in new window

0
 
LVL 1

Author Comment

by:joe90kane
ID: 35431776
That worded perfectly.
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question