Note that there are some explanatory texts on larger screens.

plurals
  1. POPossible infinite loop in mod_rewrite?
    primarykey
    data
    text
    <p>I am working on overhauling the URL structure of review pages, which can be filtered by city, county, # of stars and technician. I want to make the pages look like they are static HTML pages as well as replace pluses with hyphens. My goal: -Apply the new style URL's without modifying the reviews page, just the htaccess file -Set up 301 redirects from the old style URLs to new style URLs -Convert pluses to hyphens</p> <p>Currently the review URLs look like this:</p> <blockquote> <p>domain.com/reviews/?city=City+Name</p> <p>domain.com/reviews/?city=City+Name&amp;page=2</p> <p>domain.com/reviews/?county=County+Name</p> <p>domain.com/reviews/?county=County+Name&amp;page=2</p> <p>domain.com/reviews/?stars=4</p> <p>domain.com/reviews/?stars=4&amp;page=2</p> <p>domain.com/reviews/?tech=Tech+Name</p> <p>domain.com/reviews/?tech=Tech+Name&amp;page=2</p> </blockquote> <p>My goal is to make them look like this (and 301 the old style URLs to the new style URLs):</p> <blockquote> <p>domain.com/reviews/city/City-Name.html</p> <p>domain.com/reviews/city/City-Name/page/2.html</p> <p>domain.com/reviews/county/County-Name.html</p> <p>domain.com/reviews/county/County-Name/page/2.html</p> <p>domain.com/reviews/stars/4.html</p> <p>domain.com/reviews/stars/4/page/2.html</p> <p>domain.com/reviews/tech/Tech-Name.html</p> <p>domain.com/reviews/tech/Tech-Name/page/2.html</p> </blockquote> <p>City, county and tech names don't always contain pluses (ie Boston vs New+York) and some have more than one plus. Currently this is what I have to mask the old style URLs with new style URLs (and this works fine btw):</p> <pre><code>##FIRST PAGE REVIEWS (ie. reviews/city/city-name.html) RewriteRule ^reviews/(.*)/(.*)\-(.*)\-(.*)\-(.*)\-(.*)\.html "/reviews/?$1=$2+$3+$4+$5+$6" [NC,L] RewriteRule ^reviews/(.*)/(.*)\-(.*)\-(.*)\-(.*)\.html "/reviews/?$1=$2+$3+$4+$5" [NC,L] RewriteRule ^reviews/(.*)/(.*)\-(.*)\-(.*)\.html "/reviews/?$1=$2+$3+$4" [NC,L] RewriteRule ^reviews/(.*)/(.*)\-(.*)\.html "/reviews/?$1=$2+$3" [NC,L] RewriteRule ^reviews/(.*)/(.*)\.html "/reviews/?$1=$2" [NC,L] ##PAGINATED REVIEWS (ie. reviews/city/city-name/page/2.html) RewriteRule ^reviews/(.*)/(.*)\-(.*)\-(.*)\-(.*)\-(.*)/page/(.*)\.html "/reviews/?$1=$2+$3+$4+$5+$6&amp;page=$7" [NC,L] RewriteRule ^reviews/(.*)/(.*)\-(.*)\-(.*)\-(.*)/page/(.*)\.html "/reviews/?$1=$2+$3+$4+$5&amp;page=$6" [NC,L] RewriteRule ^reviews/(.*)/(.*)\-(.*)\-(.*)/page/(.*)\.html "/reviews/?$1=$2+$3+$4&amp;page=$5" [NC,L] RewriteRule ^reviews/(.*)/(.*)\-(.*)/page/(.*)\.html "/reviews/?$1=$2+$3&amp;page=$4" [NC,L] RewriteRule ^reviews/(.*)/(.*)/page/(.*)\.html "/reviews/?$1=$2&amp;page=$3" [NC,L] </code></pre> <p>The part that I am having trouble with is 301-ing the OLD style URLs to the NEW style URLs. This is what I have so far:</p> <pre><code>RewriteCond %{QUERY_STRING} (.*)=(.*) [NC] RewriteRule ^reviews/(.*) /reviews/%1/%2.html? [NS,R=301,NC] RewriteCond %{QUERY_STRING} (.*)=(.*)&amp;page=(.*) [NC] RewriteRule ^reviews/(.*) /reviews/%1/%2/page/%3.html? [NS,R=301,NC] </code></pre> <p>When I try this FireFox gives me the "The page isn't redirecting properly" error. Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload