How To - Written by Kerry on Tuesday, July 15, 2008 23:59 - 9 Comments

How WordPress 2.6 Broke My Permalink Structure…

…and how I got rid of the /index.php from my permalink structure for my efforts.

Since I host my site on a Windows 2003 web server I was experiencing the permalink issues reported in the WordPress.org Forums topic 189058.

I added a ‘Category base’ and a ‘Tag base’ on the Settings>>Permalinks page (not what I wanted) and it fixed the issue. As I was searching the WordPress Codex for more information about permalinks and structure tags (%category%/%postname%) I ran across this section in the ‘Using Permalinks’ article: Permalinks without mod_rewrite. It mentioned a solution using 404 redirects that did not require the /index.php in the permalink struture for IIS. I thought this was IMPOSSIBLE - until today. Since I am able to change my 404 error page on my host to what ever I want the custom 404 redirects solution was going to get a thorough test.

Basically it requires the creation of a .php file - wp-404-handler.php in this example- and substituting wp-404-handler.php for the IIS defined 404 page. The wp-404-handler.php page contains the following code:
<?php
$qs = $_SERVER['QUERY_STRING'];
$_SERVER['REQUEST_URI'] = substr($qs, strpos($qs, ‘:80′)+3);
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
include(’index.php’);
?>

I created the wp-404-handler.php file and added it to the WWWROOT folder of my website. I set all three 404 errors to use this page (404, 404;2, 404;3) using URL as the ‘Message Type’ and ‘/wp-404-handler.php’ as the URL. See below:

Website Properties

Custom Error Properties

This got rid of the /index.php but I still had the ‘Category and Tag base’ in my permalinks. Now the big question: Did my 404 redirect alleviate the need for the ‘Category and Tag base’ values.

Removed the values and….

You can now see my ‘Pretty Permalinks’. The 404 redirect fixed the need for the ‘Category and Tag base’ values as well. So now I have pretty permalinks just like my Linux buddies. No more /index.php albatros hanging around my permalinks neck. I am free, Free, FREE of this weight forever.

Thank you WordPress Codex (



9 Comments

You can follow responses to this entry through the RSS 2.0 feed. You can leave a response or trackback from your own site.

1Earth
Jul 16, 2008
05:57 am
 

I’ve seen a few people ‘fix’ this issue, but I want to know is, how will this effect links to your posts that will want to link to your URI with index.php in it?

Will your work-around automatically direct them to the same post, but minus index.php in the URI?

Kerry
Jul 16, 2008
08:05 am
 

@1Earth - The good news is both:

http://kerrywebster.com/design/branded-login-screen-plugin/
&
http://kerrywebster.com/index.php/design/branded-login-screen-plugin/

resolve to the same page. If some one has linked back to the /index.php version it will get to the same page. The issue is with the search engines (and I believe the link above to keyboardface.com talks about this in the comments) and reindexing your site. Iwish I had found this fix when it first came out but I am willing to give up the search engine ranking in the short run for the ‘Pretty Permalinks’ going forward.

1Earth
Jul 16, 2008
07:35 pm
 

Excellent. Over at amy-wong.com she also confirmed that the URI with and without index.php resolves to the same place and that Google has already (hours later) index the index.php-less URI.

I’ll get cracking on that upgrade again then, because you’re right, has to be done - your IIS work-around is, of course, a lot more work than my Linux hosted site which apparently was ALWAYS able to handle URIs without index.php *bangingheadonkeyboard* :)

1Earth
Jul 17, 2008
02:17 am
 

Kerry, thanks for your feedback. My WordPress is now 2.6 and my URIs are looking even more handsome without index.php. Cheers for that.

Kerry
Jul 18, 2008
08:04 pm
 

@1Earth - It seems this issue has been flying around the WordPress 2.6 update. I am standing on a few other’s shoulders on this one. Glad I could be of assistance

Raghu
Aug 3, 2008
02:32 pm
 

Hi Kerry,

I saw your comment about Exec Plugin not working . I tried to send this message using the contact form 5 times, but was getting error message.

http://rgc.kerrywebster.com/archives

But when I checked the page, it looks like the issue was fixed. I’m still facing the same issue.

http://www.happyschoolsblog.com/h1b/

I wanted to know how you resolved the problem?

Also, I have my role in wordpress is Admin, and I have assumed exec_php capability is set. I have installed Role Manager plugin, but not sure how to set the Capability. Any pointers will e good help.

Thanks

Kerry
Aug 6, 2008
10:04 am
 

@Raghu - It ended up being permissions. I had changed the author on the page that was executing the php and that account did not have rights to execute the code. Once that was changed back everything worked fine. I do not use the Role Manager Plugin so I am no help there.

Sandip
Sep 19, 2008
10:55 am
 

i did the 404 handle php file my site parmalink worked fine but when site is working with

http://www.mysite.com/index.php and http://www.mysite.com is going blank.

pls suggest

Trackbacks

Leave a Reply



BasecampHighrise

Comment



 

Design - Oct 26, 2008 11:42 - 7 Comments

Retro Theme Released

More In Design


News - Aug 15, 2008 15:53 - 0 Comments

Woopra Gets Mention in Practical Webdesign

More In News


How To - Jul 15, 2008 23:59 - 9 Comments

How WordPress 2.6 Broke My Permalink Structure…

More In How To




Login

107 queries. 1.515 seconds.