Rewrite Help Needed

Posted on 2011-02-11
Last Modified: 2012-05-11
I need to redirect a url

to a discontinued page.  Here is what I have tried that isn't working.

RewriteCond %{REQUEST_URI} ^12all/lt\.phpc=([0-9]+)$ [NC]
RewriteCond %{QUERY_STRING} ^&amp$ [NC]
RewriteRule ^.+$ /discontinued.html? [NC,R=301,L]

I have other rewrites working but I can't seem to get this to pattern match so I need help.


Question by:sharingsunshine
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

requeue earned 125 total points
ID: 34876255
Is your url correct ?

I think you have php script lt.php and query is ?c=1590&amp.
If that is the case url will like this:

Otherwise, you don't have query string.


Expert Comment

ID: 34876293
If my guess is correct htaccess is like this:

RewriteCond %{REQUEST_URI} ^/12all/lt\.php$ [NC]
RewriteCond %{QUERY_STRING} ^c=([0-9]+)&amp$ [NC]
RewriteRule ^(.+)$ /discontinued.html? [NC,R=301,L]

You need "/" before 12all.

Author Comment

ID: 34876737
You gave me the answer when you said it's not a query without a ?.  I removed the query string and it worked.


Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

690 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