WordPress Archive Permalinks Problem
Good evening folks,
I haven’t posted up in a while, as I’ve been busy coding the backend of the blog and making it look nice on the eyes. This being a photography blog I wouldn’t usually post this up (as it’s more web design/web dev inclined) but I’ve spend the last two days trying to fix a problem and nothing online has been of help.
The Plan
I wanted to have nice permalinks on my blog. The plan was to have them like this – blog.kyletunneyphotography.com/day/month/year/name-of-the-post/. So the last post I had up would have looked like this – http://blog.kyletunneyphotography.com/03/02/2009/first-dublin-strobist-meet/. To do this I used the code /%day%/%monthnum%/%year%/%postname%/ within my wordpress admin control panel (Settings >> Permalinks >> Custom).
The Problem
All links worked perfectly EXCEPT the archive links. So what worked?
blog.kyletunneyphotography.com/
blog.kyletunneyphotography.com/day/month/year/name-of-the-post/
blog.kyletunneyphotography.com/category/name-of-category/
What didn’t work where the archive links, like March 2008 or January 2009. They would purely bring up an error #404.
You could change your permalinks to /archives/%year%/%monthnum%/%day%/%postname%/ and everything would work find. Personally, I felt that the links were starting to get too long. After lots of searching and testing a bunch of easy and difficult solutions I decided to give in and change my Permalinks. I am now only using /%postname%/
Search Engines?
What about the big G and everybody linking back to your old links that you previously had in place? Simple, just add the following line
RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.domain.com/$4
to your .htaccess file in your wordpress directory and it will redirect all your traffic for you. So if somebody clicks a link or types in http://blog.kyletunneyphotography.com/30/01/2009/inspirational-photography-tips/ they will be automatically redirected to http://blog.kyletunneyphotography.com/inspirational-photography-tips/.
Nobody gets lost, no broken links and the big G doesn’t spank you!!
I hope that helps somebody from spending two days searching online for a fix.
Let me know if it helps,
Kyle
July 24th, 2009 at 10:26 am
Thanks a lot, man. I was completely lost and surfing the WordPress forums, to no avail. Your post cleared that up. You’re right, I went the same way you did, changing the permalinks to d/m/y/post-name and my archive and calendar went haywire.
Notwithstanding, if you change the permalinks to y/post-name, everything works fine.
I guess they need to fix that bug. Thanks for sorting that out and saving me hours of search…
July 24th, 2009 at 10:27 am
Glad to help buddy!
August 16th, 2010 at 8:30 am
I faced a similar problem and fixed it:
1. Make sure the wordpress httpd-configuration has .htaccesses enabled;
Options FollowSymLinks
AllowOverride FileInfo
2. Fix directory rights to wordpress-directory so apache can access it (read+write).
3. Change permalink structure in options => permalinks by changing the ‘common options’ value to default and clicking ‘update permalink structure’ and back to ‘date and name based’ and again clicking ‘update permalink structure’ (this causes WP to rewrite .htaccess).
4. Check httpd main config that .htaccesses are allowed; httpd.conf => under comments ‘# First, we configure the “default” to be a very restrictive set of…’ – set AllowOverride None => AllowOverride FileInfo.
5. Restart httpd.
August 16th, 2010 at 7:30 pm
Thanks Heikki!