dot htaccess 301 redirect not working

keith smith klsmith2020 at yahoo.com
Sat Apr 7 09:50:56 MST 2012


I found the solution.  I need to use the below code to catch the query string.

RewriteCond %{QUERY_STRING} ^querystringtext$

Problem solved.

------------------------

Keith Smith

--- On Fri, 4/6/12, keith smith <klsmith2020 at yahoo.com> wrote:

From: keith smith <klsmith2020 at yahoo.com>
Subject: dot htaccess 301 redirect not working
To: "Main PLUG discussion list" <plug-discuss at lists.plug.phoenix.az.us>
Date: Friday, April 6, 2012, 8:43 PM


Hi,

I'm trying to configure some 301 redirects.

The old URL looks like this : www.mydomain.tld/article.php?id=1

I need it to redirect to a new URL like this  www.mydomain.TLD/category-name/article-name

This Works : note I removed the ?id=1 from RewriteRule ^article\.php$ 

RewriteCond %{HTTP_HOST} ^mydomain\.tld$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.tld$
RewriteRule ^article\.php$ "http\:\/\/www\.mydomain\.tld\/category-name\/article-name"  [R=301,L]

This does not work - Note : RewriteRule ^article\.php?id=1$

RewriteCond %{HTTP_HOST} ^mydomain\.tld$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.tld$
RewriteRule ^article\.php?id=1$ "http\:\/\/www\mydomain\.tld\category-name\/article-name"  [R=301,L]

Thank you for any guidance.



------------------------

Keith Smith
-----Inline Attachment Follows-----

---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20120407/a06cc8a0/attachment.html>


More information about the PLUG-discuss mailing list