Htaccess Page Translation

Htaccess Page Translation

Use Google Translate to enable auto translation for foreign speakers to use your site. NOT CLOSE TO PERFECT but a nice feature with htaccess.

Step 1: Add language code to end of URL’s – for example this URL would be https://www.astralwebinc.com/htaccess_page_translation.php-he

Step 2: Add to htaccess file

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)-he$ http://www.google.com/translate_c?hl=he&sl=en&u=http://example.com/$1 [R,NC]
RewriteRule ^(.*)-fr$ http://www.google.com/translate_c?hl=fr&sl=en&u=http://example.com/$1 [R,NC]
RewriteRule ^(.*)-de$ http://www.google.com/translate_c?hl=de&sl=en&u=http://example.com/$1 [R,NC]
RewriteRule ^(.*)-es$ http://www.google.com/translate_c?hl=es&sl=en&u=http://example.com/$1 [R,NC]

SEO with GooGle Alerts

Use Google Alerts to find out new links gained by your competition, do research and help your SEO efforts in a tremendous way. Setup on an ongoing basis web alerts without you ever needed to move a finger.

Go to Google Alerts and try it yourself.

New Links By Competition

Enter in search query field
competition.com -site:competition.com
Enter in How often field
As it happens
Enter in How Many field
All Results

Find Sites to Submit to

Enter in search query field
“subject” intitle:submit OR “subject” intitle:add
Enter in How often field
As it happens
Enter in How Many field
All Results

Find Data to Write Content About

Enter in search query field
“subject” filetype:txt site:.gov
Enter in How often field
As it happens
Enter in How Many field
All Results

Speed up site with Gzip

Gzip is used for compressing your text files including text, html, php, js and css. There is no need to gzip images for they are already compressed and gzipping them will cause extra server work.
Speed up site with Gzip & PHP

Use the following code at the top of your php files to gzip your page.

Place this at the top of your htaccess file. BE SURE TO REPLACE EXAMPLE.COM WITH YOUR DOMAIN ON LINE 2 & 3:

<?php
ob_start(“ob_gzhandler”);
?>

Speed up site with Gzip & Htaccess

Use the following code in your Htaccess file: (linux and unix servers ONLY)

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
#End Gzip

301 Redirect www with Htaccess

301 Redirect Non-WWW to WWW URL’s with Htaccess

It is important to decide on a consistent URL formatting from the beginning of your site.

Place this at the top of your htaccess file. BE SURE TO REPLACE EXAMPLE.COM WITH YOUR DOMAIN ON LINE 2 & 3:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

301 Redirect WWW to Non-WWW URL’s with Htaccess

It is important to decide on a consistent URL formatting from the beginning of your site.

Place this at the top of your htaccess file. BE SURE TO REPLACE EXAMPLE.COM WITH YOUR DOMAIN ON LINE 2 & 3:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

NOTES…
* Htaccess redirects works only with linux and unix servers (not IIS)
* After completing redirect check at least two pages (homepage and sub-page) with our server header tool – Look for 301 redirect