Results 1 to 10 of 13
-
5th Jul 2010, 10:25 AM #1OPMemberWebsite's:
Doxsters.netA basic guide to htaccess
What is .htaccess?
.Htaccess is an incredible useful file that you can only use when using Apache(to my knowledge). It's got a tonne of functionality, which I will be detailing below. First of all, I should mention that most FTP Clients won't show you a .htaccess file because most of them are configured to hide "hidden" files, which are files with a "." in front of them. Luckily this can be changed to show all files.
Htaccess files allow you to specify commands(kinda) which the server follows. You can of course put these commands in your httpd.conf file but most people aren't hosted on Dedicated Servers or VPS's and don't have access to it.
Common Functions
Error Handling
Your .htaccess file can control what happens when the user lands on a 404 or 403, etc etc page. This is how most sites use custom error pages.
The command is ->
Code:ErrorDocument ERRORCODE PATHTOFILE
Code:ErrorDocument 404 404.html
This is also mighty useful for securing your site. You can control who(or more specifically which IP Addresses) can access certain parts of your site.
Okay lets say you had a few files uploaded for emergency, stored in /emergency. These files had the potential to reak havok on your site, but you had them there just incase something messed up. You didn't want anyone to access it unless something screwed up and you had to go and manually access it, this would save you reuploading the file.
What you would do in this case is put a .htaccess file in /emergency which contains:
Code:order allow,deny deny from all
But what if you wanted a certain IP Address to access that section?
Luckily, htaccess files can do that as well.
Heres what you would put in the htaccess file instead.
Code:order deny,allow deny from all allow from YOURIPHERE
To do this, wrap your corresponding commands in <Files FILENAME>
For example to protect Database.zip files from being viewed, you would add this to your main .htaccess
Code:<Files Database.zip> order deny,allow deny from all allow from YOURIPHERE </Files>
Code:<Files ~ "\.(zip)$"> order deny,allow deny from all allow from YOURIPHERE </Files>
Redirects
Htaccess files can also be used for redirecting.
The command for this is:
Code:redirect TARGETFILE REDIRECTEDTO
Code:redirect /google.html http://www.google.com
The Ifmodule tag is useful, it allows you to check whether the server has a certain module enabled.
For example,
Code:<IfModule mod_autoindex.c> ADDITIONAL CODE HERE </ifModule>
You can also change the first page the server looks for with htaccess, usually index.html.
To do this add the following to your htacecss
Code:DirectoryIndex FILE1 FILE2 FILE3
For example, with the code
Code:DirectoryIndex blah.php blahblah.php blahblahblah.php
Thats about it for this basic tutorial, I've only scratched the surface of the mighty .htaccess file and yet my fingers are dying
I seriously encourage you to do some research into it, it is mega useful
I might continue this later, but for now that's it.
Oh and this was written by timtamboy63 for chrixel.com and besthostingforums.comtimtamboy63 Reviewed by timtamboy63 on . A basic guide to htaccess What is .htaccess? .Htaccess is an incredible useful file that you can only use when using Apache(to my knowledge). It's got a tonne of functionality, which I will be detailing below. First of all, I should mention that most FTP Clients won't show you a .htaccess file because most of them are configured to hide "hidden" files, which are files with a "." in front of them. Luckily this can be changed to show all files. Htaccess files allow you to specify commands(kinda) which the server Rating: 5
Need a Designer/Web Developer? Click Me
MSN: PM me for it.
Email(Preferred):timtamboy63@gmail.com
"Power Corrupts. Absolute Power Corrupts Absolutely"
-
5th Jul 2010, 10:30 AM #2Retired NinJaWebsite's:
loledhard.comNice work. Truely appreciate ur work.
.htaccess can do wonders sometime, u just need to know how to use it.
If u use it wrong ur WEB Dir would be unavailable to u via web.
You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!
-
5th Jul 2010, 10:32 AM #3Banned
Great stuff timtamboy63.
Thank you.
-
5th Jul 2010, 10:33 AM #4Member
good work, thank you
-
5th Jul 2010, 12:11 PM #5OPMemberWebsite's:
Doxsters.netI'll be posting more on chrixel btw, but i'll keep posting a few on here
Oh and I just fixed a small error, its httpd.conf not http.conf
Need a Designer/Web Developer? Click Me
MSN: PM me for it.
Email(Preferred):timtamboy63@gmail.com
"Power Corrupts. Absolute Power Corrupts Absolutely"
-
5th Jul 2010, 12:16 PM #6mmm mmm!
Good Tutorial
HATERS GONNA probably bring up some valid points considering I am an ignorant little twat so far up my own ass that i blame my problems on everyone and if you criticize me you're automatically wrong.
-
5th Jul 2010, 01:16 PM #7Member
great thanks. Appreciate your effort
-
6th Oct 2010, 02:22 AM #8Member
noob question. i wanna rewrite mydomain.com/?c=signup displaying mydomain/signup.php, how's that using htaccess? sorry for my english.
gomu gomu no..
..flying fuck!
-
10th Oct 2010, 05:10 AM #9OPMemberWebsite's:
Doxsters.net
Need a Designer/Web Developer? Click Me
MSN: PM me for it.
Email(Preferred):timtamboy63@gmail.com
"Power Corrupts. Absolute Power Corrupts Absolutely"
-
10th Oct 2010, 05:29 AM #10Banned
awesom tut bud
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Guide] Warez Starter Guide For *n00bs* :D
By CyberAff in forum Tutorials and GuidesReplies: 19Last Post: 14th Nov 2012, 03:01 PM -
Basic Guide Line Needed to start a adult site
By Z_UpLoAdEr in forum Webmaster DiscussionReplies: 7Last Post: 17th Oct 2011, 06:18 AM -
[TUTORIAL] A basic guide to flipping domains for newbies.
By Webjax in forum Tutorials and GuidesReplies: 0Last Post: 20th Sep 2011, 02:42 AM -
what's the Basic difference?
By kamrul in forum General DiscussionReplies: 2Last Post: 31st Aug 2009, 07:28 PM -
Comprehensive guide to .htaccess
By DeXTeR in forum Technical and Security TutorialsReplies: 2Last Post: 8th Nov 2008, 02:53 AM
themaCreator - create posts from...
Version 3.22 released. Open older version (or...