Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-26-2004, 07:02 AM   #1 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
Server config / .htaccess

I plan on collecting information on .htaccess files for use as a tutorial on this very site.

But, where do I put it? Answer: First of all I insist we need even more sub forum topics This one would probably be 'server config'.

But then, it wouldn't be too popular as this is a Code Newbie site, not a server config site.

Put it in 'Windows'? But then can .htaccess files be used on other OSs? If yes then 'Windows' is not the place to put it.

'Other Language'? But .htaccess files aren't really a programming language as such. Or is it?


Where to put it??
Or should I just not bother with writing it as this is not the place for it? Or is it?

21 questions...
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Old 08-26-2004, 07:07 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
good question .. .htaccess is more of an apache thing. i think apache is more closely related to linux than it is windows, .. so maybe put it in the linux category??? ( until a better option comes up )

are you going to include the code that you need to configure in the apache configuration?

also, what method of setting up the userfile are you going to use? htpasswd? dbmmanage?

i look forward to reading it.
__________________
Mike
sde is offline   Reply With Quote
Old 08-26-2004, 07:27 AM   #3 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,139
Belisarius is on a distinguished road
Apache is a bit of a cross-culture thing, as many newbies look to use it on Windows, but the more experienced guys use it in *nix.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 08-26-2004, 07:29 AM   #4 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
Cool

Quote:
Originally posted by sde
are you going to include the code that you need to configure in the apache configuration?
Only as far as saying that not all servers services may support .htaccess files and if you run your own server then I'll give directions on making sure .htaccess files are activated. I shall also be stating the disadvantages.

Quote:
also, what method of setting up the userfile are you going to use? htpasswd? dbmmanage?
Uhh...
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Old 08-26-2004, 07:52 AM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
hehe, maybe you should read up more on it before you write a tutorial

check out these threads i've inquired about recently:

http://codenewbie.com/forum/t2271.html
http://codenewbie.com/forum/t2174.html
__________________
Mike
sde is offline   Reply With Quote
Old 08-26-2004, 07:53 AM   #6 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
Well I know basic .htaccess stuff!

Remember what I said when I first came here about teaching others as I learn? :p

The first version of it will be a reference list with brief explainations.

A later version that I might do will include some more detail and how-tos and other stuff. I think.

EDIT: I just did a Google search for '.htaccess' and clicked the first search result in the list. The first thing it states is
Quote:
This seems to be what people think htaccess was meant for, but it is only part of the general use. We'll be getting into progressively more advanced stuff after this.
How bloody ironic :th:

And so...maybe I'll put this tutorial on my TODO list for the next ten years...
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Old 08-26-2004, 08:04 AM   #7 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
i do, that is the best way .. while both the new questions and information you find are fresh in your head.

i'm just saying, understand 'how' and 'why' it works before you write a tutorial.

honestly i didn't know there were configurations you had to setup in the apache config till i tried to use .htaccess on one of my client's new redhat servers and it did not work.

don't get overwhelmed on the subject .. just read 'Admin's' response to my question and that should point you in the right direction for the apache side of things. it's pretty simple. ( especially if you read the apache documentation on AllowOverride Directive and of course .htaccess )
__________________
Mike
sde is offline   Reply With Quote
Old 08-26-2004, 08:54 AM   #8 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
I've decided to put the advanced stuff on hold for now and write 2 tutorials for the 'HTML' tutorial section.

.htaccess -- custom error pages
.htaccess -- preventing image hotlinking


I will lay them out the same starting with saying there are many things you can do with .htaccess files but this is one of the more popular uses. For now I won't be including this, but when I've done both articles - is it ok to link them to each other under a title, 'Related'?

EDIT: I've started the error doc one already but unsure on something. If I can set an error page to be either of the below, what's the point of the latter? What advantages does it have over the first? :
Code:
ErrorDocument 404 /errors/notfound404.html
ErrorDocument 500 "The server is buggered!"
EDIT2: I'm almost finished with this error page tutorial and I was wondering if there was a way we could code this error page to tell the administrator what page has the broken link? My first thought was using a flat file database like WebErrorLog.txt that gets written to in the 404 page itself stating only the most vital info:
Quote:
BrokenLink /directory/pageWithBrokenLink.html
The format in which this is written is not important so long as our webadministrator can look at this log and know which page to fix. Anybody know how to do this/provide linkage?

I was also thinking that the webadmin can be emailed every time a user clicks a broken link with the same info as the above quote?


Or is there an easier/predetermined route of doing this?
(lets assume that the admin is too lazy to check all links before FTP to webserver)
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a

Last edited by DavH27; 08-26-2004 at 09:19 AM.
DavH27 is offline   Reply With Quote
Old 08-26-2004, 04:28 PM   #9 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
Never mind. I'm sure I'll find a solution by looking at the 'Link Tracking' section of HotScripts.com or something.

Anyway I did a tutorial on Custom error pages and only got half way and posted it. I thought I could just edit it like you would normally with a forum post but it's disappeared! If I post the new version, what will happen to the older one? Will it save over the top? Will you guys have to manually delete it?
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Old 08-26-2004, 04:38 PM   #10 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Sounds like a good tutorial idea. I've done numerous things with htaccess files, but never really work with them enough on a regular basis to remember things indepth.


Other .htaccess ideas:

- modifying php vars.
- mod_rewrite - although mod_rewrite is a beast of its own. using .htaccess is really just a method for delivery.
- along the custom error pages idea, maybe have two versions. The standard "custom html error page" one and a php-based error page version that provides more functionality.

-- eg: it logs the error in a DB, emails the admin, perhaps performs some kind of basic search for the user to give them hints as to what they want.

edit: hm, guess I should read all of the posts.

Quote:
I was also thinking that the webadmin can be emailed every time a user clicks a broken link with the same info as the above quote?
The email idea is good, but could quickly turn into mass-mail bomb. Maybe only email once every X 404's, but log everything?
idx is offline   Reply With Quote
Old 08-26-2004, 04:50 PM   #11 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
Yeah that email idea could prove to be quite a handful with sites bigger then a postage stamp...

Thing is, I don't know enough php to know what I can do here so I'm all ears to you guys. I can then go and do some script-chopping and viola - a nice lil tutorial for you guys to feel proud of

BTW this needs removing http://codenewbie.com/tutorials/2274.html

EDIT: We have to think modular here, guys. I dont' want to have to tell people to manually edit every single page in thier website. I want to be able to put the logging scripts in the error docs themselves. I could easily do this if I knew how to call the last page from the current page.

I have a good article for working with flat file databases, I just need a way of picking up that little piece of information of what page was last clicked. I think there is a hyperlink cheat that will push the browser back one page, regardless of location. Something like "../" I think. Will this work?

Damn guys I really don't know what I'm trying to do here!

EDIT2: I've just realised something. What if the browser is pointing to this broken link with the attribute target=_blank ?? This will mean that trying to find the last page won't work if it is in a seperate browser window.

Will this work:
When a link is clicked, an entry is made to the errorLog file. If the error page does show, then the entry stays there. If the correct page shows then the most top/recent entry gets deleted.

???

Can this be done with a variable? When the user clicks, $ErrorEntry = "Date, current file name, target file". When the right page loads, this variable is cleared $ErrorEntry. If the error file shows then the variable $ErrorEntry is sent tot he flat file database.

This variable method...id it works with 404 code then it will work with any of the other codes.
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Old 08-26-2004, 04:57 PM   #12 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
this search seems helpful. (can't go wrong with onlamp)

-r
idx is offline   Reply With Quote
Old 08-26-2004, 05:16 PM   #13 (permalink)
DavH27
PHP Pilgrim
 
DavH27's Avatar
 
Join Date: Aug 2004
Location: London
Posts: 167
DavH27 is on a distinguished road
Sonovvabizartch!!

I wanted to be one of those peoples that writes an innovative script that everybody will want! From ME!!

Kind of ironic that the author of this article has the same first name as me :p

Thanks dude.
Do you still think I should detail methods of feedback or just link them to this article?

Isn't the goal to get as many users on this site to stay on this site? What would be the point of looking at a tutorial on this site that points to another tutorial on another site? Lost visitors then! Do you guys think I should rework this article's methods and deliver another tutorial detailing this lot? Opinions Opinions cmon guys feedback!!
__________________
Davy - Programming since 1998 [CV]
Currently working on: n/a
Status: n/a
DavH27 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Specifying SMTP server for PHP mail() Epsilon PHP 2 03-18-2004 12:20 AM


All times are GMT -8. The time now is 01:10 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting