From the Blogabout me

Removing /index.php/ from WordPress URL’s

Occasionally, I have clients ask why their URL’s for WordPress have changed or maybe they moved from one hosting provider to another and they now see /index.php/ in their URL.  This does not only pertain to WordPress though, as it could affect other Content Management Systems (CMS) or even general software.

Recently I was helped setup a person who had moved their WordPress site and a great billing/time tracking online system, that I encourage you to look into, called Pancake from Hostgator to InMotion. But once everything was moved over they noticed this issue in all URL’s and it caused Pancake to really act up without being any issue with Pancake itself, and just made WordPress links look ugly.  So that’s when I realized it was time for me to do a quick walk-through on how removing/index.php/ from WordPress URL’s without a plugin being needed.

So I want you to go into your .htaccess file within the root directory of your website. Open it with your favorite text editor, and make sure this information is there and at the top of the file. Save and put back on the server.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

Note, if you are using Rackspace, you may need to add a little more code:


<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On

# On some hosts (including Rackspace), you need to remove the "#" that comes before RewriteBase to avoid 404 errors:
# RewriteBase /

# Block access to hidden files and directories.
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpe?g|gif)$ $1.$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>

I realize this is not the most exciting topic, nor the easiest to explain, so if you have any questions please let me know.

Inserting shortcode into ANY template…

Do you have a great plugin that you use all of the time, but wish you could put it in a very custom location, maybe on the index.php or footer.php page of your template, instead of just a Post or Page?

Luckily there is a very simple way to do this…

Instead of just using [your shortcode info], you will want to go to your location of your template,
and change it to <?php echo do_shortcode( [your shortcode info] ) ?>

 

Sounds easily enough, huh?

 

Let’s look at an example I recently used was for the wpaudio plugin. I wanted to put near the bottom of just my index.php page, and not on any Post/Page within the site.

Step #1
To keep it simple, I went to Add New Post, added a MP3 file using the standard Upload/Insert >> Add Audio icon, selected my MP3 file and said Insert Into Post.

The Post then had this piece of code:

Step #2
So, I then copied this into Notepad, and slightly edited the code to look like this:

<?php echo do_shortcode(‘‘); ?>

 

Step #3
I pasted this code into my index.php file, and was good to go.