<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Apache RewriteRule and query string</title>
	<atom:link href="http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/</link>
	<description>Simone Carletti&#039;s personal ramblings on programming, syndication, search engines &#38; marketing.</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:24:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dirk Rüdiger</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-40598</link>
		<dc:creator>Dirk Rüdiger</dc:creator>
		<pubDate>Fri, 03 Feb 2012 21:28:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-40598</guid>
		<description>Thanks for this very informative and helpful post!

Best regards, Dirk</description>
		<content:encoded><![CDATA[<p>Thanks for this very informative and helpful post!</p>
<p>Best regards, Dirk</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-40585</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Tue, 17 Jan 2012 18:51:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-40585</guid>
		<description>I am trying to give each MOVIE there own url name, for example, www.helloworld.com/BATMAN. I have been using mod_rewrite to create such url. I have been using following htaccess code to achieve such result.

 RewriteEngine ON
 RewriteCond %(REQUEST_FILENAME) !-d
 RewriteCond %(REQUEST_FILENAME) !-f
 RewriteCond %(REQUEST_FILENAME) !-l

 RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

The mod_rewrite works perfectly. When A user enters randam movie name (name that does not exist in database), for example, www.helloworld.com/abcd, I have created a url redirect which is www.helloworld.com/oopsmovienotfound.php. This works fine too. But the problem I am having is this: When user click www.helloworld.com/login.php .The url keeps looping between login.php and oopsmovienotfound.php OR the url is forwarded to www.helloworld.com/oopsmovienotfound.php beacause database doesnot have &quot;login.php&quot; as a movie name. I thought this command

 RewriteCond %(REQUEST_FILENAME) !-f 

should have take care of this but its not. Please help. Thank you in advance.</description>
		<content:encoded><![CDATA[<p>I am trying to give each MOVIE there own url name, for example, <a href="http://www.helloworld.com/BATMAN" rel="nofollow">http://www.helloworld.com/BATMAN</a>. I have been using mod_rewrite to create such url. I have been using following htaccess code to achieve such result.</p>
<p> RewriteEngine ON<br />
 RewriteCond %(REQUEST_FILENAME) !-d<br />
 RewriteCond %(REQUEST_FILENAME) !-f<br />
 RewriteCond %(REQUEST_FILENAME) !-l</p>
<p> RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]</p>
<p>The mod_rewrite works perfectly. When A user enters randam movie name (name that does not exist in database), for example, <a href="http://www.helloworld.com/abcd" rel="nofollow">http://www.helloworld.com/abcd</a>, I have created a url redirect which is <a href="http://www.helloworld.com/oopsmovienotfound.php" rel="nofollow">http://www.helloworld.com/oopsmovienotfound.php</a>. This works fine too. But the problem I am having is this: When user click <a href="http://www.helloworld.com/login.php" rel="nofollow">http://www.helloworld.com/login.php</a> .The url keeps looping between login.php and oopsmovienotfound.php OR the url is forwarded to <a href="http://www.helloworld.com/oopsmovienotfound.php" rel="nofollow">http://www.helloworld.com/oopsmovienotfound.php</a> beacause database doesnot have &#8220;login.php&#8221; as a movie name. I thought this command</p>
<p> RewriteCond %(REQUEST_FILENAME) !-f </p>
<p>should have take care of this but its not. Please help. Thank you in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carsten</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-40466</link>
		<dc:creator>Carsten</dc:creator>
		<pubDate>Fri, 25 Nov 2011 23:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-40466</guid>
		<description>Hi!

I have a Parameter without a Value, in my URL like that: /home.weblog.html?rss

Now, i want to redirect to a new location /feed/ 

I try the following, but it doesn&#039;t work:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^rss$
RewriteRule ^home\.weblog\.html$ /feed/? [R=301,L] 

It only works, if i put a value to the parameter - for example rss=0 and do the redirect like that:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^rss=0$
RewriteRule ^home\.weblog\.html$ /feed/? [R=301,L] 

It seems, that a parameter-name without value is not in the %{QUERY_STRING}... 

How can i solve my problem?</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I have a Parameter without a Value, in my URL like that: /home.weblog.html?rss</p>
<p>Now, i want to redirect to a new location /feed/ </p>
<p>I try the following, but it doesn&#8217;t work:</p>
<p>RewriteEngine on<br />
RewriteCond %{QUERY_STRING} ^rss$<br />
RewriteRule ^home\.weblog\.html$ /feed/? [R=301,L] </p>
<p>It only works, if i put a value to the parameter &#8211; for example rss=0 and do the redirect like that:</p>
<p>RewriteEngine on<br />
RewriteCond %{QUERY_STRING} ^rss=0$<br />
RewriteRule ^home\.weblog\.html$ /feed/? [R=301,L] </p>
<p>It seems, that a parameter-name without value is not in the %{QUERY_STRING}&#8230; </p>
<p>How can i solve my problem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaartikeyan R</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-40422</link>
		<dc:creator>Kaartikeyan R</dc:creator>
		<pubDate>Wed, 02 Nov 2011 12:28:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-40422</guid>
		<description>www.xyz.com/c73-Graphic-Desgin?resultpage=2&amp;aid=1

in this URL

&quot;73&quot; and &quot;2&quot; and &quot;1&quot; are Values
i tried to rewrite it like this 

RewriteRule ^c([0-9]+)-(.+)-(.+)?resultpage=(.+)&amp;aid=(.+)$ templates.php?cid=$1&amp;resultpage=$4&amp;aid=$5&amp;search=yes.

But its not working... please help me to solve this issue... thanks in advance...!</description>
		<content:encoded><![CDATA[<p><a href="http://www.xyz.com/c73-Graphic-Desgin?resultpage=2&#038;aid=1" rel="nofollow">http://www.xyz.com/c73-Graphic-Desgin?resultpage=2&#038;aid=1</a></p>
<p>in this URL</p>
<p>&#8220;73&#8243; and &#8220;2&#8243; and &#8220;1&#8243; are Values<br />
i tried to rewrite it like this </p>
<p>RewriteRule ^c([0-9]+)-(.+)-(.+)?resultpage=(.+)&amp;aid=(.+)$ templates.php?cid=$1&amp;resultpage=$4&amp;aid=$5&amp;search=yes.</p>
<p>But its not working&#8230; please help me to solve this issue&#8230; thanks in advance&#8230;!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benny</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-39189</link>
		<dc:creator>benny</dc:creator>
		<pubDate>Fri, 30 Sep 2011 16:40:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-39189</guid>
		<description>May be a silly question but when you redirect

http://www.pets.com/show_a_product.php?product_id=7

To
http://www.pets.com/products/7/

The form in show_a_product.php is expecting a product_id

Also there is no page on the server called
products/7/

What am I missing?

Thanks</description>
		<content:encoded><![CDATA[<p>May be a silly question but when you redirect</p>
<p><a href="http://www.pets.com/show_a_product.php?product_id=7" rel="nofollow">http://www.pets.com/show_a_product.php?product_id=7</a></p>
<p>To<br />
<a href="http://www.pets.com/products/7/" rel="nofollow">http://www.pets.com/products/7/</a></p>
<p>The form in show_a_product.php is expecting a product_id</p>
<p>Also there is no page on the server called<br />
products/7/</p>
<p>What am I missing?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-35908</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sun, 24 Jul 2011 20:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-35908</guid>
		<description>Best, concise mod_rewrite tutorial out here. Awesome as a refresher on tricky stuff.
I was getting stuck, thanks to you I&#039;ve found the missing link to what I needed to accomplish.
I owe you a beer! ;-)</description>
		<content:encoded><![CDATA[<p>Best, concise mod_rewrite tutorial out here. Awesome as a refresher on tricky stuff.<br />
I was getting stuck, thanks to you I&#8217;ve found the missing link to what I needed to accomplish.<br />
I owe you a beer! ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeremy warren</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-33529</link>
		<dc:creator>jeremy warren</dc:creator>
		<pubDate>Sat, 18 Jun 2011 05:31:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-33529</guid>
		<description>Thank you! Your explanation is the missing link to this mod rewrite mystery. Really, this is great.</description>
		<content:encoded><![CDATA[<p>Thank you! Your explanation is the missing link to this mod rewrite mystery. Really, this is great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Gruhler</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-33470</link>
		<dc:creator>John Gruhler</dc:creator>
		<pubDate>Fri, 17 Jun 2011 02:01:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-33470</guid>
		<description>I am new and made stupid permalink changes, about 5 times, on my wordpress blog Lifejustiz® Needless to say google has me over 4100 not found and unreachable errors. 

my current permalink structure is: /%post_id%/%postname%/ I am using this for the last 3 months.

I have about five permalinks that I used before the latest that have all the errors:

/%postname% , /%postname%/.html , /%postname%.html , could you possibly show me a modrewrite example of how to design redirect permanent to my new and current permalink /%post_id%/%postname%/
all of my changes to permalink structure have a common post id number or postname..I really do not understand the process of query strings and how they apply. I have spend a thousand hours of readind and research and still cannot understand. I am 73 years old and hate to admit that I have problems understanding this stuff. Please help me get this settle...I will never change a permalink again once I get this fixed.

I am about to lose my mind over this stuff...John Gruhler</description>
		<content:encoded><![CDATA[<p>I am new and made stupid permalink changes, about 5 times, on my wordpress blog Lifejustiz® Needless to say google has me over 4100 not found and unreachable errors. </p>
<p>my current permalink structure is: /%post_id%/%postname%/ I am using this for the last 3 months.</p>
<p>I have about five permalinks that I used before the latest that have all the errors:</p>
<p>/%postname% , /%postname%/.html , /%postname%.html , could you possibly show me a modrewrite example of how to design redirect permanent to my new and current permalink /%post_id%/%postname%/<br />
all of my changes to permalink structure have a common post id number or postname..I really do not understand the process of query strings and how they apply. I have spend a thousand hours of readind and research and still cannot understand. I am 73 years old and hate to admit that I have problems understanding this stuff. Please help me get this settle&#8230;I will never change a permalink again once I get this fixed.</p>
<p>I am about to lose my mind over this stuff&#8230;John Gruhler</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-16978</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Wed, 03 Nov 2010 05:09:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-16978</guid>
		<description>The following rewrite is not working:

Trying to go from:
http://www.example.com/here/page.jspa?theID=35

To:
http://www.example.com/anotherpage/9999 (no correlation with theID above)

Using:
RewriteRule ^here/page\.jspa\?theID=35$ anotherpage/9999 [R=301,L]

I believe because there is a querystring in the From I cannot use that syntax and must first convert like:
RewriteCond %{QUERY_STRING} ^theID=1$
RewriteRule ^here/page\.jspa$ anotherpage/9999 [R=301,L]

Also, what is the best method if I have over 50,000 redirects from old pages that do not have matching IDs? The theID in the old system does not map to an ID in the new system. Do I have to have 50,000 RewriteCond and 50,000 corresponding RewriteRule?

Thanks for any help on this issue,
Frank</description>
		<content:encoded><![CDATA[<p>The following rewrite is not working:</p>
<p>Trying to go from:<br />
<a href="http://www.example.com/here/page.jspa?theID=35" rel="nofollow">http://www.example.com/here/page.jspa?theID=35</a></p>
<p>To:<br />
<a href="http://www.example.com/anotherpage/9999" rel="nofollow">http://www.example.com/anotherpage/9999</a> (no correlation with theID above)</p>
<p>Using:<br />
RewriteRule ^here/page\.jspa\?theID=35$ anotherpage/9999 [R=301,L]</p>
<p>I believe because there is a querystring in the From I cannot use that syntax and must first convert like:<br />
RewriteCond %{QUERY_STRING} ^theID=1$<br />
RewriteRule ^here/page\.jspa$ anotherpage/9999 [R=301,L]</p>
<p>Also, what is the best method if I have over 50,000 redirects from old pages that do not have matching IDs? The theID in the old system does not map to an ID in the new system. Do I have to have 50,000 RewriteCond and 50,000 corresponding RewriteRule?</p>
<p>Thanks for any help on this issue,<br />
Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Brinson</title>
		<link>http://www.simonecarletti.com/blog/2009/01/apache-rewriterule-and-query-string/#comment-15605</link>
		<dc:creator>Michael Brinson</dc:creator>
		<pubDate>Sat, 02 Oct 2010 04:58:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.simonecarletti.com/blog/?p=135#comment-15605</guid>
		<description>@ Jodi
Probably too late (It&#039;s been 4 months since you posted) but I think the problem with your code is your carrot (^) at the beginning of your regex string for the  RewriteCond statement.

Here&#039;s your code:

RewriteCond %{QUERY_STRING} ^id=20$
RewriteRule ^/index.php$ http://www.bonniegreendesigns.com.au/index.php?main_page=page&amp;id=20 [L,R=301]

Here&#039;s what it should be:

RewriteCond %{QUERY_STRING} id=20$
RewriteRule ^/index.php$ http://www.bonniegreendesigns.com.au/index.php?main_page=page&amp;id=20 [L,R=301]

The only difference being the removal of the &quot;^&quot; in front of &quot;^id=20$&quot; on the &quot;RewriteCond&quot; line.

The %{QUERY_STRING} variable in this case actually would contain &quot;main_page=page&amp;id=20&quot; because it contains everything that comes after the &quot;?&quot; character.  So with the regex string of &quot;^id=20$&quot; you are saying:

&quot;Match this string if the string begins with &quot;id&quot; and ends with &quot;20&quot;&quot;.

The string does not begin with id, it begins with &quot;main_page&quot;, therefore the match fails and the rewrite rule is skipped.

To Simone Carletti:   THANK YOU, THANK YOU, THANK YOU!!!
Great post and exactly what I was needing.  Really can&#039;t thank you enough.</description>
		<content:encoded><![CDATA[<p>@ Jodi<br />
Probably too late (It&#8217;s been 4 months since you posted) but I think the problem with your code is your carrot (^) at the beginning of your regex string for the  RewriteCond statement.</p>
<p>Here&#8217;s your code:</p>
<p>RewriteCond %{QUERY_STRING} ^id=20$<br />
RewriteRule ^/index.php$ <a href="http://www.bonniegreendesigns.com.au/index.php?main_page=page&#038;id=20" rel="nofollow">http://www.bonniegreendesigns.com.au/index.php?main_page=page&#038;id=20</a> [L,R=301]</p>
<p>Here&#8217;s what it should be:</p>
<p>RewriteCond %{QUERY_STRING} id=20$<br />
RewriteRule ^/index.php$ <a href="http://www.bonniegreendesigns.com.au/index.php?main_page=page&#038;id=20" rel="nofollow">http://www.bonniegreendesigns.com.au/index.php?main_page=page&#038;id=20</a> [L,R=301]</p>
<p>The only difference being the removal of the &#8220;^&#8221; in front of &#8220;^id=20$&#8221; on the &#8220;RewriteCond&#8221; line.</p>
<p>The %{QUERY_STRING} variable in this case actually would contain &#8220;main_page=page&amp;id=20&#8243; because it contains everything that comes after the &#8220;?&#8221; character.  So with the regex string of &#8220;^id=20$&#8221; you are saying:</p>
<p>&#8220;Match this string if the string begins with &#8220;id&#8221; and ends with &#8220;20&#8243;&#8221;.</p>
<p>The string does not begin with id, it begins with &#8220;main_page&#8221;, therefore the match fails and the rewrite rule is skipped.</p>
<p>To Simone Carletti:   THANK YOU, THANK YOU, THANK YOU!!!<br />
Great post and exactly what I was needing.  Really can&#8217;t thank you enough.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

