Reputation: 8245
I'm using mod_rewrite to write more user friendly URLS for my site. I copied and modified a working rule for another page, but it doesn't seem to want to work...
Here's the rule
RewriteRule ^list/(.*)/page/([0-9])/$ list.php?date=$1&page=$2
The working rule lookst like this
RewriteRule ^read/(.+)/$ read.php?target=$1
As far as I can see, the new rule should work... If anyone can suggest why it doesn't and possibly provide a fix, I'd greatly appreciate it
Thanks for your time!
Upvotes: 0
Views: 66
Reputation: 8245
Boy do I feel like an idiot now...
I had a look at this again this morning when I got in to work and found that there actually wasn't anything wrong with the rule. I hadn't changed my links...
For anyone referencing this, experiencing similar problems:
If you write a RewriteRule like I have above, make sure you change your link href
attributes to use the new URL
So, in my case...
RewriteRule ^list/(.*)/page/([0-9]+)/$ list.php?date=$1&page=$2
The links have to change from
<a href="list.php?date=2012April&page=1>April 2012</a>
To
<a href="/list/2012April/page/1/
I forgot to change the links derp
Upvotes: 0
Reputation: 475
if your page number can have multiple digits, that part of the expression should be ([0-9]+) to require 1 or more digits.
Upvotes: 1