Tag Archives: .htaccess

WordPress permalinks with Greek/Russian/Arabic characters

Server Settings
OS: Linux
HTTP Server: Apache2
Database: MySQL (utf-8)
Scripting Language: php 5
Software: wordpress 3.0.4 – wp-confing.php

define('DB_CHARSET', 'utf8');

Create an .htaccess file in your root directory ( e.g www.example.com/ )

vi .htaccess #(you may have to sudo or su)

Add the following lines in the file .htaccess file…

# Disable Directory Browsing
Options All -Indexes
# Secure access to .htaccess files
<Files .htaccess>
order allow,deny
deny from all
</Files>

Save the file and exit vi (:wq).
You may have to give full access rights to .htaccess!?

chmod 777 .htaccess #(you may have to sudo or su)

Open your favorite browser, go to your www.example.com/wp-admin section then choose

Settings -> Permalinks

and apply your custom structure…

( e.g /%year%/%monthnum%/%postname%/ )

Save Changes

IMPORTANT
Remove the full access rights from .htaccess!

chmod 644 .htaccess #(you may have to sudo or su)

You are done! Enjoy your wordpress custom permalinks in your preffered language.

I have test it with greek, russian and arabic and worked as a charm!
See an example…
http://www.my-soul.net/blog/

😉

1 Star2 Stars (+40 rating, 18 votes)
Loading...

Hotlinking, Bandwidth Theft and mod_rewrite

Have you seen your bandwidth increase without reason !?!?!
I guess you have…
Hotlinking (Bandwidth Theft) makes your bandwidth limit up!

Senario
You have taken a few nice photos with your brand new camera and you have uploaded them to your blog (website) so family,friends and visitors could see them.
That is so… nice.
That is what the HotLinkers said too.

Solution
Use the mod_rewrite module of Apache.
Let’s say your site’s url is www.MyDomain.com.
Fire up your preffered editor, copy these lines below…

RewriteEngine On
# Uncomment the next line if you have placed your images in a folder called photos. As you can see /photos/ is in root directory and the .htaccess file will take care all the subfolders if you have any...
# RewriteBase /photos/
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?MyDomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|swf|flv|png|JPG)$ http://www.MyDomain.com [R,NC]

and paste them to a file you will call .htaccess (mind the dot please… it’s important!)
Put the .htaccess file to the folder where your photos are…
That’s all!

Keep in mind that even Google will not be able to HotLink your images. If you want to allow this, just insert this line…

RewriteCond %{HTTP_REFERER} !^http://(www\.)?images.google.com(/)?.*$ [NC]

Before the RewriteRule.
Now you are done.

“The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.”
— Brian Behlendorf

“Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo.”
— Brian Moore

😉

1 Star2 Stars (+17 rating, 4 votes)
Loading...