Use Wordpress as CRM system


Background

I have been looking for a clean and simple CRM solution for my web site for some time. I use this web site more like a sketch block where I ramble down some of my findings and howto’s mainly for my self. To simplify this process, I wanted to convert my old, file based PHP-site to something a bit more dynamic and easily maintainable. I didn’t do a deep analysis of what’s available, but I quickly browsed through some alternatives (Drupal, Expression Engine, Movable Type and Wordpress). To make a long story short; I went for Wordpress because of earlier experience with this tool.

It was quite easy to cut’n paste all my content into its “pages” system. The problem arised when I needed to figure out how i could redirect all my .html and .php filenames to folder names that all new systems base their URL structure on.


Creative Commons License photo credit: MR+G

Most of the content are from 2000-2003 and all of it are comprehensively crawled by Google and linked up by others. So breaking those links was not an option. Hacking Wordpress to make it possible to use .php and .html endings was not either to smart, both because it was too time consuming and also that I didn’t wanted to alter Wordpress and make it harder for me to future upgrades.

Solution: Rewrite-rules in .htaccess files

And that’s really why I wrote this article – it wasn’t too much information about this on the web. This is what I wanted to do:

Permantent redirect (301) /linux/mutt.php to /linux/mutt/
and remove all index.php so /linux/index.php becomes /linux/

My .htaccess file


RewriteEngine On
RewriteBase /

# Removes index.php-pages
RewriteCond %{THE_REQUEST} \/index\.php(.*)\ HTTP/ [NC]
RewriteRule ^([^.]*)index\.php(.*)$ http://webdirect.no/$1 [R=301,L]

# Externally redirect direct client requests for .php files to non-.php URLs
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/){1,10}[^.]+\.php(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://webdirect.no/$1 [R=301,L] 

# Externally redirect direct client requests for .php files to non-.php URLs
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/){1,10}[^.]+\.html(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.html$ http://webdirect.no/$1 [R=301,L]

# standard wordpress rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Rewrite rules explained

# Removes index.php-pages
RewriteCond %{THE_REQUEST} \/index\.php(.*)\ HTTP/ [NC]
RewriteRule ^([^.]*)index\.php(.*)$ http://webdirect.no/$1 [R=301,L]

This one just removes all /index.php from requests and creates a permanent redirect (HTTP 301) so crawles can detect that this page has moved to a new URL

# Externally redirect direct client requests for .php files to non-.php URLs
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/){1,10}[^.]+\.php(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://webdirect.no/$1 [R=301,L]

Removes .php extensions if the depth of the URL strucure are between 3 and 10 slashes. This to allow some root files to have .php ending, like /login.php for example.

So, what about .php files from Wordpress?

Yes, that’s right. Wordpress uses .php-extention on many internal files that’s crucial to make the dog fly, and since rewrite-rules in .htaccess files are inhereted, we have to turn off rewriting in some folders (/wp-admin).

This .htaccess file turns of all rewrite rules so Wordpress can function like it’s meant to in this folder.

.htaccess file inside /wp-admin

<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>

As always, if you know a smarter way to do this, leave a comment, please!

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Hi…. I was looking on the web for such a use of Wordpress (as a CRM). However, there are no real success stories or elaborate DIYs.

I am interested to know if you are still using wordpress for CRM and is it possible for me to see a demo?

thanks,
Anwin

@Anwin – yes, I’m still using wordpress and if you would like to try its capabilities I suggest you create a free wordpress blog at http://wordpress.com

NiksNeup say: I did not speak it.

_____________
vigara
buy cheap meds online
2

What’s Happening i’m fresh to this, I stumbled upon this site I find It positively helpful and its helped me loads. I hope to contribute & help others like it has helped me.

Thanks, See You Around.