Recently I decided to change one of my permalinks on my site from /tests to /reviews. I also set up a redirect on cPanel to redirect any traffic from /tests to /reviews this is essential as Google has already indexed /tests so setting up a 301 redirect will tell Google the page has moved and avoid a nasty 404 page not found error.
However this didn’t work once I made the redirect in cPanel I got a Word Press 404 error for both /tests and /reviews! This is because the redirect rule in your .htaccess file is added at the bottom of the file after Word Press’s mod rewrite rules. Simply add the cPanel redirect rule above the Word Press mod rewrite rule and all shall be fixed again.
Best post this as its quite a handy trick. If you ever password protect the wp-admin directory via Apache (which is a good thing to help stop hacking attempts) you will notice it breaks the uploading of any media.
Just add the below rules to your .htaccess file inside the wp-admin directory.
Allow from all
Ok here is a simple fix for when you add a password protected directory via Cpanel but are using the mod rewrite apache rule for making search engine friendly URLs (permalinks).
For instance having a password protected directory ‘/protected’ will just come up with a 404 not found message on your word press site as it thinks its a permalink.
To fix this just add the following to the top of your .htaccess file that Cpanel generates found inside ‘/protected’ directory
ErrorDocument 401 default
From a recent project I have found a few plug-ins that I find essential when developing with word press.
All in One SEO Pack
Out-of-the-box SEO for your WordPress blog
AWS Easy Page Link
Easier way to link to already existing pages in your WordPress site
Exclude Pages from Navigation
Provides a checkbox on the editing page which you can check to exclude pages from the primary navigation. IMPORTANT NOTE: This will remove the pages from any “consumer” side page listings, which may not be limited to your page navigation listings.
Used to overlay images on the current page. Images in one post are grouped automatically.
A NextGENeration Photo gallery for the Web 2.0.
Enables advanced features and plugins in TinyMCE, the visual editor in WordPress.
Viper’s Video Quicktags
Easily embed videos from various video websites such as YouTube, DailyMotion, and Vimeo into your posts.
Word press by default takes the title of your page and uses it for the menu title too. This can be annoying if you want to have say “Welcome to my Website” as your title on your page but only reference it as “Home” on the menu bar.
So I hear you say ‘why not create a custom menu as you can label the menu items?’ Yes you could but from my experience if you are dealing with clients who don’t really know what they are doing you need to make it as simple as possible. The custom menu doesn’t automatically update the menu items when new pages are added by default. With my method the menu is still updated automatically.
This is actually really easy to solve with a little bit of PHP and using the custom fields section when making your page.
So first create your page and call it ‘Home‘ this will be used as the menu item name. Now make a custom field on your page called ‘pagetitle‘ and add the value you want for your main page title.
Now open your ‘page.php‘ file and add the following code;
First at the top add this line, which gets your custom field and assign it to the var ‘$meta_values‘
ID, “pagetitle”, true); ?>
Now find any reference to ‘the_title();‘ usualy found in <h2> and <h1> tags and replace with the following code;
What the above does is checks if you have actually made a custom field for that page, if true it will use that field as the main page title. If not true it will just use the same value you originally named your page. This way you don’t have to add a custom field to all your pages, only the ones you want to have different page titles too.