Redirect permanent /directory-name
(Log in om link te zien!)
Block IP-Addresses
You can block IP-Addresses with .htaccess. Or you can block all addresses and accept your own. This code shows how you allow everyone and you block two addresses.
order allow, deny
deny from 123.123.123.123
deny from 234.234.234.234
allow from all |
|
And this code shows how you block all IP addresses and you allow 2 other.
oder allow, deny
deny from all
allow from 123.123.123.123
allow from 234.234.234.234 |
|
HTML file as PHP file
You can parse an HTML file as a PHP file. Now you will think: “why would you do that?” Well if you have an old website with only HTML files and you are linked by other websites or you are in Google with your HTML files and you will change to PHP files. Then all the HTML files will be gone and that is bad for Google and your link partners. Well, you can do this also with a redirect, but there’s a better manor to do that. You can parse a HTML file as a PHP file. And you can do that with this code:
AddType application/x-httpd-php .php .htm. html |
|
This code will say to Apache that all the .htm and .html files need to be parsing as .php. You can test it yourself. Make a HTML page with a php code inside. Add this code to you .htaccess file and look!
Set your standard page in your directory
Not everyone wants an index.php or index.html as standard page. With .htaccess you can change this. If you want hous.html as standard page. You can use this code:
You also can use more files. By this code the server first will try to go to hous.html, if that file don’t exists, he will try garage.html.
DirectoryIndex hous.html garage.html |
|
Avoid directory browsing
Directory browsing is that if you don’t have an index page, you can see a list of all files. By some servers is this already standard that nobody can see that list. And the visitor get’s a forbidden message. But if it doesn’t is standard. You can use this simple code.