Deny/Allow Certian IP Addresses
You can block an IP address by using:
deny from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2 of the groups of numbers, you will block a whole range.
You can allow an IP address by using:
allow from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2 of the groups of numbers, you will allow a whole range.
If you want to deny everyone from accessing a directory, you can use:
deny from all
but this will still allow scripts to use the files in the directory.
Redirection
Redirect /olddirectory http://www.newsite.com/newdirectory
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
Redirect permanent http://www.xyz.com/ http://abc/
order deny,allow
Page Open Without WWW(abc.com)
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.abc\.com)(:80)? [NC]
RewriteRule ^(.*) http://abc.com/$1 [R=301,L]
order deny,allow
Hide .PHP Extension from the Url
IF YOU ENTER WRONG FILE THEN IT WILL RETURN TO INDEX PAGE
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
You can block an IP address by using:
deny from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2 of the groups of numbers, you will block a whole range.
You can allow an IP address by using:
allow from 000.000.000.000
where 000.000.000.000 is the IP address. If you only specify 1 or 2 of the groups of numbers, you will allow a whole range.
If you want to deny everyone from accessing a directory, you can use:
deny from all
but this will still allow scripts to use the files in the directory.
Redirection
Redirect /olddirectory http://www.newsite.com/newdirectory
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
Redirect permanent http://www.xyz.com/ http://abc/
order deny,allow
Page Open Without WWW(abc.com)
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.abc\.com)(:80)? [NC]
RewriteRule ^(.*) http://abc.com/$1 [R=301,L]
order deny,allow
Hide .PHP Extension from the Url
RewriteEngine On RewriteRule ^([^\.\?]+)(\?.*)?$ $1.php================================================================================Making Friendly URLs
Here’s an example of a dynamic URL: http://www.yourdomain.com/?c=5&p=20 A better (SEO) alternative of this URL would be: http://www.yourdomain.com/articles/5/20-seo-techniques.html# Enable mod_rewrite RewriteEngine On # Sets the base URL for per-directory rewrites RewriteBase / RewriteRule ^articles/([0-9]+)/([0-9]+)-seo-techniques.html$ /?c=$1&p=$2
IF YOU ENTER WRONG FILE THEN IT WILL RETURN TO INDEX PAGE
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
No comments:
Post a Comment