Forum Moderators: phranque
#Calendar
RewriteRule ^calendar$ calendar/ [R]
RewriteRule ^calendar/?$ calendar.php #This is the only rule that seems to be used
#day view
RewriteRule ^calendar/today$ calendar/today/ [R]
RewriteRule ^calendar/today/?$ calendar.php?action=day&date=today
RewriteRule ^calendar/([0-9]+)-([0-9]+)-([0-9]+)$ calendar/$1-$2-$3/ [R]
RewriteRule ^calendar/([0-9]+)-([0-9]+)-([0-9]+)/?$ calendar.php?action=day&date=$1-$2-$3
#add event
RewriteRule ^calendar/add-event/(single-dayŚmulti-day)$ calendar/add-event/$1/ [R]
RewriteRule ^calendar/add-event/(single-dayŚmulti-day)/?$ calendar.php?action=add-event-$1
Now my problem is that no matter what I enter after calendar/ it always rewrites to calendar.php
So that...
calendar/today/ -rewrites to> calendar.php
calendar/not_even_a_rule/ -rewrites to> calendar.php
calendar/just/does/not/matter/ -rewrites to> calendar.php
Also the [R] flag just seems to be ignored.
This setup works great under apache 2.0, any idea why it's behaving this way?
Driven me nuts to work out what is happening, only to open another browser or try it on another machine and see that it was working all along.
#Calendar
RewriteRule ^calendar/add-event/(single-day¦multi-day)$ calendar/add-event/$1/ [R]
RewriteRule ^calendar/add-event/(single-day¦multi-day)/?$ calendar.php?action=add-event-$1 [L]RewriteRule ^calendar/([0-9]+)-([0-9]+)-([0-9]+)$ calendar/$1-$2-$3/ [R]
RewriteRule ^calendar/([0-9]+)-([0-9]+)-([0-9]+)/?$ calendar.php?action=day&date=$1-$2-$3 [L]
RewriteRule ^calendar/today$ calendar/today/ [R]
RewriteRule ^calendar/today/?$ calendar.php?action=day&date=today [L]
RewriteRule ^calendar$ calendar/ [R]
RewriteRule ^calendar/?$ calendar.php [L]
I'm going crazy. This thing is really slowing down my project.
What is the possibility that my home router is caching everything?
Putting on my divining hat, here's what I think you want:
# Calendar Rules
#
# Externally redirect to append trailing slash if missing
RewriteRule ^calendar/add-event/(single-dayŚmulti-day)$ http://www.example.com/calendar/add-event/$1/ [R=301,L]
RewriteRule ^calendar/([0-9]+)-([0-9]+)-([0-9]+)$ http://www.example.com/calendar/$1-$2-$3/ [R=301,L]
RewriteRule ^calendar/today$ http://www.example.com/calendar/today/ [R=301,L]
RewriteRule ^calendar$ http://www.example.com/calendar/ [R=301,L]
#
# Externally redirect to canonical domain if non-canonical domain is requested
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#
# Internally rewrite calendar/ URLs to calendar script
RewriteRule ^calendar/add-event/(single-dayŚmulti-day)/$ calendar.php?action=add-event-$1 [L]
RewriteRule ^calendar/([0-9]+)-([0-9]+)-([0-9]+)/$ calendar.php?action=day&date=$1-$2-$3 [L]
RewriteRule ^calendar/today/$ calendar.php?action=day&date=today [L]
RewriteRule ^calendar/$ calendar.php [L]
If you include the domain canonicalization rule, then the rules must be kept in the order shown -- Specific URL redirects, canonical domain redirect, internal rewrites.
Replace the broken pipe "Ś" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.
Jim