Enable Permalinks for WordPress in Apache web server

Permalinks are `permanent links` that would point to blog posts, categories and tags etc. The permalink mechanism WordPress enabled by default
is not very SEO friendly – it just give an indentifier to each post and refer to them with single parameter.

Default permalink setting:
http://example.com/?p=1

When the search engines crawl the website it gives considerable score for the keywords in the permalink that relates to the page content. Therefore it is advantageous to change the default permalink setting so that you can include meaningful keywords in the permalink structure.

Preferable setting:
http://example.com/sample-post/

However if you’re deploying wordpress on your VPS and using Apache as webserver you’ll have to do some extra configuration to get the permalinks working. Otherwise when you’re accessing each post it would throw 404 errors.

First enable the Apache rewrite module

sudo a2enmod rewrite

Then go ahead and edit the apache configuration file located in /etc/apache2/apache2.conf

Here you’ll have to change the instances of 'AllowOverride None' to 'AllowOverride All'

Changed configuration file entries should look like this:

<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>


<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

after making all these changes restart Apache and you’re good to go.

Ramanan Sharma

Drupal Security Update Required FTP Server in Mac OS X Mountain Lion

I was developing Drupal in my MacBook with XAMPP server setup. I was tweaking with a different distribution and that needed an important security update. I was trying to update and there came the need for an FTP connection to the localhost.

Apple has disabled the FTP Server in Mac OS X Mountain Lion. Here is the little tweak that helped me to start the disabled FTP Server in order to get the job done.

Start the FTP:
sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

Verify the FTP is working by issueing this command
ftp localhost

Stop the FTP:
sudo launchctl stop com.apple.ftpd

Start the FTP again:
sudo launchctl start com.apple.ftpd

When the update prompts FTP credentials – provide machine username and password. This gets the job done.

Though FTP usage is discouraged due to it’s security vulnerabilities – this was the easiest way of tackling Drupal issue in local environment.

If you are seriously considering a secure FTP server in your Mac, check the PureFTPd Manager from the following link:
http://jeanmatthieu.free.fr/pureftpd/

 

Edit:
I encountered the same issue with WordPress development in MAMP Server setup. Easiest solution was to set the proper permission to the wordpress directory. Apache runs as the user _www:


sudo chown -R _www:_www wordpress_directory

Also this will work

sudo chgrp -R _www wordpress_directory/

Same technique could work for Drupal issue as well.

WordPress Migration to VPS – 2

I recently moved my wordpress blog from a shared hosting to linode VPS. Migration was smooth except few tiny problems. One of them is doing updates to wordpress, plugins or themes.

I started getting this error:

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed

To solve this problem first I had to configure an ftp server. Refer to this for more details:
Installing FTP Server in Ubuntu 12.04

Then I added the following to wp-config.php file

define('FTP_USER', 'user');
define('FTP_PASS', 'user-password');
define('FTP_HOST', 'localhost');

And it started working fine. No need restart the nginx or any other processes.

Installing PostgreSQL in Ubuntu

sudo apt-get install postgresql
sudo apt-get install pgadmin3

Now basic postgres server and gui client tool is installed

Let’s login to default user ‘postgres’ and add a password, Enter this command –

sudo -u postgres psql postgres

You get the psql command prompt and enter this command to add password for user ‘postgres’

postgres=# \password postgres

Then Ctrl + D to exit the postgres console

 

For additional contrib package

sudo apt-get install postgresql-contrib-9.1

Delete .svn directories in Linux

If you are using svn in Linux + Eclipse, you might encounter this problem. There will be lot of hidden .svn directories created in each folder. This should be cleaned if you’re going to commit this as a separate project.

Enter this command in the home directory of the project

rm -rf `find . -type d -name .svn`

Or create a bash script as follows and save this as /usr/bin/csvn

#!/bin/sh
echo "recursively removing .svn folders from"
pwd
rm -rf `find . -type d -name .svn`

Now calling csvn command in any project directory will recursively delete the .svn directories under that.

Remember you’ll have to modify file permissions – for the script to become executable.