custom permlink .htaccess file 404 Not Found error

If your WordPress installation is in the folder ‘sitename’, than this .htaccess should go in that folder. Not your theme folder. From the WordPress codex: WordPress’s index.php and .htaccess files should be together in the directory indicated by the Site address (URL) setting on your General Options page (http://codex.wordpress.org/Using_Permalinks)

Text in permalink

There is no template for “/widget”. Templates are about content types and not URL fragments. IMO your page hack is totally legit. Another way to handle this is to have a widgets category which is the parent of all other categories and change your permalink structure to /%category%/%postname%/

redirect old pages by .htaccess

%postname% is not a mod_rewrite rewrite tag. You are going to have to write out the path. mod_rewrite operates before WordPress, or PHP, gets involved. You don’t have access to any of that functionality. If your “contact” page– the page named “contact”– has ID 213 you shouldn’t have to do anything to redirect, though. This … Read more

WP Custom Permalink Filter

strlen(”) in substr_replace will always evaluate to 0, which doesn’t replace anything. It just inserts the new url at $pos. You could use this: function modify_attachment_link( $markup, $id ) { $pos = strpos( $markup, ‘href’ ) + 6; $remainstring = substr( $markup, $pos ); $pos2 = strpos( $remainstring, “‘” ); $url = substr( $remainstring, 0, … Read more