.HTACCESS MOD_REWRITE OR JUST MAGIC



Warning: readfile(/home/pureflash/public_html/inc/advertisment-small.html) [function.readfile]: failed to open stream: No such file or directory in /home/pureflash/public_html/htaccess/index.php on line 29

.HTACCESS or .htaccess files?

Hi, as you all know I'm Marian M.Bida and now I must present .htaccess files, powered by mod_rewrite on apache web server


Proffesional work done with .htaccess, mod_rewrite technology

As you can notice most of my projects are based on .htaccess technology, google, me and everyone else are loving htaccess, you must use it, use it, use it now

My scripts

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
rewriterule web-design-links.html /Links/ [r=301,nc]
	

BASICS REGEXP

Text:
.           Any single character

[chars]     Character class: One  of chars
[^chars]    Character class: None of chars
text1|text2 Alternative: text1 or text2 (ie. "or")

Quantifiers:
?           0 or 1 of the preceding text

*           0 or N of the preceding text	(hungry)
+           1 or N of the preceding text

Grouping:
(text)	Grouping of text
	(either to set the borders of an alternative or
	for making backreferences where the nth group can 
	be used on the target of a RewriteRule with $n)


Anchors:
^           Start of line anchor
$           End   of line anchor

Escaping:
\char		escape that particular char
		(for instance to specify special characters.. ".[]()" etc.)

 

.htaccess Redirects

Pages redirection

	Redirect 301 /myOldPage.html http://www.pureflash.net/myNewPage.html
	Redirect 301 /myOldPage.html http://www.pureflash.net/myOldPage/
	

Entire site redirection

	Redirect 301 / http://www.pureflash.net/ 
	

Timeline redirecting

	RewriteEngine on
	RewriteCond %{TIME_HOUR}%{TIME_MIN} >0100
	RewriteCond %{TIME_HOUR}%{TIME_MIN} <1200
	RewriteRule ^.*$ http://www.pureflash.net/good-morning.html
	

Control access

.htaccess is used to conrol to individual files or folders. Like "includes" files folder. All site's pages must use these include scripts as they need and like, but users must not see these files directly. You can just add a line in your .haccess file a few lines..

NO ENTRANCE!

    # nobody sneak in!
    deny from all
	

CLOSED for LAN outsiders!

	# my kung-fu is stronger!
	order deny,allow
	deny from all
	allow from 192.168.1.0/35
	# try shis too..
	allow from 192.168.0
	

Date.Day redirects

	RewriteEngine on
	RewriteCond %{TIME_DAY} >1
	RewriteRule ^.*index\.html$ %{TIME_DAY}.html
	

HTACCESS WORMS SECURITY - How to stop IIS worms called (BW Eaters)

Everyone knows that Windows IIS web server is not the best alternative
There are some worms that use the security hole like searching for the cmd.exe and try to reach the NT dos shell and execute some code.
The interesting fact is that when they hit an Apache, they are redirected to ERROR 404. Not bad at all, but while they are redirecting meanwhile sometimes they make a lot of extra traffic.
Well write this in your .htaccess file to avoid all.

	RedirectMatch (.*)cmd.exe$ http://gotohell.fucker$1
	RedirectMatch (.*)root.exe$ http://gotohell.fucker$1
	RedirectMatch (.*).dll$ http://gotohell.fucker$1
	

note: IF YOUR ARE USING WINDOWS WEB HOSTING NEVER USE first line from the directive.

.htaccess friends web sites

Materials from www.corz.org

Regular Expressions

simple guide to regular expressions
PHP
	function read((string) $src){
		//lost your files
		return readfile($_SERVER['DOCUMENT_ROOT'].$src);
	}
	
.info .org Flash web design development varna