Solved

Rewrite Help Needed

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

http://www.abc.com/12all/lt.phpc=1590&

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.

Thanks,

Randal
0
Comment
Question by:sharingsunshine
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
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:
http://www.abc.com/12all/lt.php?c=1590&amp

Otherwise, you don't have query string.

0
 
LVL 2

Expert Comment

by:requeue
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.
0
 

Author Comment

by:sharingsunshine
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.

Thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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…
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…

831 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