Professional Documents
Culture Documents
Lecture 8
Lecture 8
Lecture 8
Lecture 8
1
.htaccess File
Web Programming – Fall 2010
Common Usage:
Security
Customized error responses (e.g. 404)
Redirects
CacheControl: control user agent caching to
reduce bandwidth usage, server load etc.
Most commands in htaccess are meant to be
placed on one line. Turn off word-wrap
3
.htaccess
Web Programming – Fall 2010
Redirect /olddirectory/oldfile.html
http://yoursite.com/newdirectory/newfile.html
ErrorDocument 404 /errors/notfound.html
IndexIgnore *
IndexIgnore *.gif *.jpg
order allow,deny
4
CGI
Web Programming – Fall 2010
#include <iostream>
using namespace std;
int main()
{
cout << "Content-Type:text/html"<<endl;
cout << endl;
cout << "<html><body>";
cout << "Hello";
cout << "</body></html>";
return 0;
}
CGI
Web Programming – Fall 2010
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
cout << "Content-Type:text/html"<<endl;
cout << endl;
cout << "<html><body>";
cout << "You queried " << getenv("QUERY_STRING");
cout << "</body></html>";
return 0;
}
Implicit Objects
Web Programming – Fall 2010
Log Out