Forum Moderators: phranque
I have a site where I want to use friendly urls for dynamically generated pages, particluarly in a calendar control on my blog, and so far I am only partially successful.
Using an .htaccess file that was recommended to me, I have been able to change the following url (that displays archived entries by months)
http://mysite.com/blog/index.php?blogid=1&archive=2005-1
to
http://mysite.com/blog/archive-1-2005-01.html
But I have not figured out a way to change the following url (that displays archived entries for individual days)
http://mysite.com/blog/index.php?blogid=1&archive=2005-1-8
to
http://mysite.com/blog/archive-1-2005-01-8.html
I really don't know regular expressions, or .htaccess, but I have tried to hack away at it without success. Here is my .htaccess file so far:
###################################################
RewriteEngine On# The next line is for selecting individual months in the calendar control and archives--it is working
RewriteRule ^archive-([0-9]+)-([0-9]+)-([0-9]+).html+ index.php?archive=$2-$3&blogid=$1
RewriteRule ^item-([0-9]+).html+ index.php?itemid=$1
RewriteRule ^archivelist-blog.html+ index.php?archivelist=$1
RewriteRule ^cat-([0-9]+)-([0-9]+).html+ index.php?catid=$1&blogid=$2
# The last two lines are for selecting individual dates in the calendar control but it is not working.
# I know the RewriteCond line works, because it traps the condition okay--but the last line is FUBAR
RewriteCond %{REQUEST_URI} archive-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html
RewriteRule ^archive-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html+ index.php?archive=$2-$3&blogid=$1-$5&itemid=$4
If anybody could please help, it would be fantastic!
Thanks,
Phil