I`ve been doing some reading recently about the potential uses of ".htaccess" files.
What does your typical .htaccess file look like?
Do you often modify it or just use the hosting company`s (blank) default file.
What .htaccess mods do you commonly employ
Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.
Page 1 of 1
What .htaccess mods do you commonly employ
#2
Posted 02 June 2008 - 01:30 AM
.htaccess files are pretty handy things. I use different commands for different areas and/or sites, but here are some of the things I use it for:
- forwarding non www links to the www domain (for cookie related reasons)
- allowing the use of alternate file extensions rather than php
- mod rewriting in which a page is accessed using the .html extension, but is in fact a .php extension (user cant tell the difference)
- setting area specific php.ini settings
- creating custom http status pages (301, 302, 400, 500 etc)
- setting the directory to not list if someone pics a non-existant file (access denied page is shown instead of the directory listing)
- setting the index page for a folder for when no page-name is added to the directory in the URL (ex: user enters www.example.com and gets www.example.com/default_page.php)
And more I'm sure! I just can't think of anything off the top of my head.
- forwarding non www links to the www domain (for cookie related reasons)
- allowing the use of alternate file extensions rather than php
- mod rewriting in which a page is accessed using the .html extension, but is in fact a .php extension (user cant tell the difference)
- setting area specific php.ini settings
- creating custom http status pages (301, 302, 400, 500 etc)
- setting the directory to not list if someone pics a non-existant file (access denied page is shown instead of the directory listing)
- setting the index page for a folder for when no page-name is added to the directory in the URL (ex: user enters www.example.com and gets www.example.com/default_page.php)
And more I'm sure! I just can't think of anything off the top of my head.
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
#3
Posted 02 June 2008 - 01:43 AM
haku
Thanks for the reply.
Is there some kind of "standard" .htaccess file that you use before adding further site specific customisation?
It seems to me that some of the things you listed would be useful to have on ANY site and
hence might be used by default rather than re-inventing the wheel each time round.
Much the same as CSS resets are used.
Thanks for the reply.
Is there some kind of "standard" .htaccess file that you use before adding further site specific customisation?
It seems to me that some of the things you listed would be useful to have on ANY site and
hence might be used by default rather than re-inventing the wheel each time round.
Much the same as CSS resets are used.
#4
Posted 02 June 2008 - 04:00 AM
I don't have a standard one that I use, but I could probably put one together!
Here are some of the commands I mentioned:
Don't list files in directory:
Set default index page for directory:
Set my own file extension other than .php:
note: I use the .ajax extension for all of my server-side ajax scripts, just as my own sort of filing system. They are all php files though.
Here are some of the commands I mentioned:
Don't list files in directory:
Options -Indexes
Set default index page for directory:
DirectoryIndex default-page.php
Set my own file extension other than .php:
AddHandler application/x-httpd-php5 .ajax
note: I use the .ajax extension for all of my server-side ajax scripts, just as my own sort of filing system. They are all php files though.
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
#5
Posted 02 June 2008 - 04:41 AM
Thanks a lot.
Can you recommend a good book or even an online resource
that explains .htaccess files in depth?
Would a book on Apache cover it you think?
Can you recommend a good book or even an online resource
that explains .htaccess files in depth?
Would a book on Apache cover it you think?
#6
Posted 02 June 2008 - 05:32 AM
Great tips haku - they'll help me in the future!
#7
Posted 02 June 2008 - 08:10 AM
I've pondered trying to buy something on htaccess commands, but so far all the stuff I've picked up has just been surfing around on the internet and seeing what I can find. There are forums dedicated to .htaccess files (you may even see my username on some of them!), and there are countless tutorials out there.
Actually, everything I've picked up web development related has been stuff I've found on the internet. I don't own even one book on web design development! I rape google.
Actually, everything I've picked up web development related has been stuff I've found on the internet. I don't own even one book on web design development! I rape google.
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
Share this topic:
Page 1 of 1


Help
This topic is locked
MultiQuote










