HTA Script – Parse HTML files as PHP




Tagged Under : , ,

Version: 13.1
Revision: 23 Build 13

Parse HTML files as PHP

pickaweb-server-logoIntroduction:
On the 29th of October, I was trying to get my server to parse php codes from a html / htm file. However, when I tried to define the extension, my server just prompt the user to download a file. But, that is not what I wanted! So, I asked Pickaweb for assistance. Soon enough, my problem was fixed!

Here is my tutorial for Pickaweb users. But, please be aware that this article is only for user who is registered with Pickaweb, as their hosting provider.

Notes: by parsing php codes inside your html file, you can implement image – ads and other sources without touching your main file. This is also useful if you’re adding a big chunk of codes without messing your original html / htm files.

1.] Login to your FTP server and look for your “.htaccess” file.

2.] Rename the file and download it to your hard drive.

3.] Copy one of these codes and paste it to the bottom of your “.htaccess” file.

// For PHP5 Server.
// -----------------------
AddHandler application/x-httpd-php5 .html .htm
AddType x-mapp-php5 .html .htm

// For PHP4 Server.
// ----------------------
AddHandler application/x-httpd-php4 .html .htm
AddType x-mapp-php4 .html .htm

4.] Save your changes and delete your old “.htaccess” file (online server).

5.] Upload your modified file and rename it. After that, you will need to clear your Internet caches and temporary files.

6.] Check your website and have fun!

7.] You are done!

Copyrighted By Lair360




HTA – Redirect everyone for site maintenance




Tagged Under : , , ,

Version: 13.2
Revision: 34 Build 13

HTA – Redirect everyone for site maintenance.

Introduction:
When I was checking my email, I had a request from a university student.
He’s asking me for help about blocking users from an old domain and redirecting them to a new domain. But, he wants to check his old domain, while the other users is redirected to his new domain.

Notes: this is also useful if you want to tell “Google Engine” if you are changing domain names.

Alright, this is kind of dificult for coders. But, it does work if you know how to construct it.
It’s like Chess & Checkers! It means, you have to create codes from trails and errors. Ofcourse, HTA script is not that hard, if you study VBScript and think of these codes as physics equations.

Anyway, if anybody wants to use this script, you must have a “Static IP Address” with HTA engine enabled.
If you haven’t got HTA engine, then you’ll need to consult this problem with your hosting provider.

Warning: if you want to check your old domain, you must input the correct IP address (your IP Address), or else, you be redirected to your new domain.
But, if you want to keep this script, forever. You’ll need to comment out the “Remote Address”. Just add ‘#’ before the codes. But, this is only acceptable if you still own the previous domain name. Nevertheless, if you have SSL encryption, please use the ones that has: “https” – labeled.

Caution *1: if there is a problem with the script, please remove “R=301″ and replace it with “R”.
Caution *2: if your website has SSL, please comment “HTTP_HOST” and remove the comments for “SERVER_PORT”.

Notes: to use everything as default, just use the ones below and replace your domain names with yours.

HTA – Redirect everyone to a new domain (accept you).
———— Copy Text —————

RewriteEngine On
Options +FollowSymLinks
# This is where you add your IP address.
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
#---------------------
# This is use if your hosting provider requires ports.
# RewriteCond %{SERVER_PORT} 80 [NC,OR]
# RewriteCond %{SERVER_PORT} 443 [NC]
# RewriteCond %{REQUEST_URI} example
#---------------------
# Match a specific domain OR sub domain (if it exist).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.cc$ [NC]
# %1 is the sub domain (or empty).
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]
# RewriteRule ^(.*)$ https://%1example.net/$1 [R=301,L]

———— End —————

Notes: if you don’t have SSL and the above looks complicated, please use this instead of the above.
———— Copy Text —————

RewriteEngine On
Options +FollowSymLinks
# This is where you add your IP address.
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
# Match a specific domain OR sub domain (if it exist).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.cc$ [NC]
# %1 is the sub domain (or empty).
# %2 is SSL encryption (or disabled)
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]

———— End —————

Copyrighted By Lair360




HTA – CEO friendly redirects




Tagged Under : , , ,

Version: 11.1
Revision: 23 Build 13

HTA – CEO friendly redirects.

Introduction:
when I was eating at the Fish ‘n Chips shop, my head was thinking about links redirect (www and non – www). But, its not just about this redirect! It’s about Google CEO rules. This means, I have to create a small HTA file that consist these redirect codes without hurting Google search engines. However, it will take time for your Search Engine to get use to these HTA rules. But, don’t panic, these codes was written and tested for a month!

The conclusion? There is no record yet about Google penalty… lucky me!
———————

1.] Download Notepad++ (http://notepad-plus.sourceforge.net/) from the author’s website and install the application.

2.] Paste these codes and save it as: “codes.htaccess” file. After that, just delete your old HTA file (which is located in your server) and upload your new version. Then, you’ll need to rename it as: “.htaccess” (without the ‘codes’).

3.] Refresh your browser and let the changes take effect.

- Codes without WWW.
—————————-

<IfModule mod_rewrite.c>
RewriteEngine On
#Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

—————————-

- Codes with WWW.
—————————-

<IfModule mod_rewrite.c>
RewriteEngine On
#Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

—————————-

Copyrighted by Lair360




How to redirect non – encrypted webpage to SSL




Tagged Under : , , , , , ,

Version: 13.1b
Revision: 43 Build 12

How to redirect non – encrypted webpage to ssl encrypted webpage

Introduction:
when I was repairing my website and directories, I’ve managed to re-direct all of my webpages to SSL encrypted pages. However, this techniques requires “htaccess” script for redirecting webpage. This will only work with a private IP address + SSL supported server.

Notes: for this to work, you must have a private IP address and a working SSL certificate. These can be obtained by the hosting provider.
Just talk to them and they will sort these out for you. When you’re done, you can read this tutorial…

1.] Execute your FTP application and log-in. Wait for the server to connect and navigate yourself to your Wordpress directory. After that, you must look for your htaccess files and transfer them to your hard drive. When you’re done with this procedure, please execute your htaccess file (from your hard drive) and make sure that you have this or something that is / are similar.

<IfModule mod_rewrite.c>
RewriteEngine On
#Options +FollowSymlinks
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress

2.] If you have the source, which is shown above, please add this below “# END WordPress” and save your work.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} wp-login.php
RewriteRule ^(.*)$ https://webpages.co.uk/blog/$1 [R,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} wp-admin
RewriteRule ^(.*)$ https://webpages.co.uk/blog/$1 [R,L]
</IfModule>

Notes: if you want your entire blog to be encrypted, please use this source provided. But, you must alter “webpages.co.uk” with your own website / domain. Also, the default port is 80. But, if there is a problem with your ports, please consult your problems with your hosting provider.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} blog
RewriteRule ^(.*)$ https://webpages.co.uk/$1 [R,L]
</IfModule>

3.] Save your progress and delete your old htaccess file (which is from your server). When you’re done, please double check your server and upload your modified htaccess file. After that, you must clear your internet temporary files and check your website.

4.] Done!

Copyrighted by Lair360




How to remove world wide web – WWW




Tagged Under : , ,

Version: 13.1
Revision: 22 Build 12c

How to remove world wide web – WWW

Introduction:
everyday in my life, there are hundreds of users, who would like to get rid of this annoying “world wide web”, which is located on their hosting services and the address bar. These strings can be remove by using “htaccess” commands, to redirect a web-link into an url without “www”.

Example: all urls will be redirect by the ‘htaccess’ files, from “www.example.com” to “example.com”, even if the “www” is typed into the address box.

1.] Create a single “.htaccess” file or add this code into the top of your “.htaccess” file.
But, you must delete your old “htaccess” files (server files) before you transfer it into your hosting server. If you overwrite it, the codes will not work…

—Copy Source Code—

<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.example\.come$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
</IfModule>

—End Source Code—

Notes: replace “example” with your own domain names (before you import). After that, just clear your internet browsers’ temporary files and caches.

2.] Check your website by typing the urls with “www” and see it for yourself.

3.] Finish!

Tips: if you want to be smart and keep your page rank from being slaughter, you can use this htaccess methods to hide this problem.

—Copy Source Code—

<IfModule mod_rewrite.c>
RewriteEngine On
#Options +FollowSymLinks
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

—End Source Code—

Notes: just remove the “#” symbol, if you want to activate “FollowSymLinks”.