Navigate/Search

Archive for the 'Apache' Category

DocumentRoot must be a Directory

Sunday, August 9th, 2009

Apparently you’ll get this error in Windows:

Syntax error on line 173 of C:/Program Files/Apache Software Foundation/Apache2.2/conf/vhosts.conf:
DocumentRoot must be a directory

If you have a trailing slash in your VirtualHost configuration for that particular domain.

Useful Apache .htaccess tricks

Monday, March 2nd, 2009

Ask Apache is chock full of awesomeness but these are the links that immediately jump out.

ErrorDocuments:

List of 57 HTTP Status Codes and Apache htaccess file ErrorDocuments

Redirection:

301 Redirect Cheatsheet – mod_rewrite, javascript, cfm, perl, php, refresh, python

Advanced HTTP Redirection

I posted this previously for another alternative of redirecting users when your pages change.

And this for letting users know something has changed when your pages change.

SEO:

503 Status Code Search Engine SEO

Security:

Security Tips for Securing your website, server, blog using .htaccess

Use mod_rewrite to redirect one domain to another via GET

Tuesday, January 27th, 2009

Dave Child ran into this problem a while back when the idiotic Jack Daniels corporation decided to flex its mighty talons.

RewriteCond %{REQUEST_METHOD} ^GET [NC] # Only rewrite GET requests
RewriteCond %{HTTP_HOST} olddomain\.com [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} olddomain\.com [NC] # Otherwise block
RewriteRule ^(.*)$ - [F]

Redirect all GET requests to new domain (only redirecting GET because POST to old domain is almost certainly automated spam – no genuine users should ever be posting to old domain if it’s been completely redirected). Serve 403 to any other request. — Dave Child

Miscellaneous .htaccess tips

Tuesday, January 27th, 2009

It’s quite rare to find a useful forum post anywhere so I thought I’d make note of some useful information that was passed around.

http://www.webmasterworld.com/apache/3430745.htm

(Click here for an archived copy.)

http://corz.org/serv/tricks/htaccess.php

mod_rewrite and 403 errors

Tuesday, January 27th, 2009

I’m not entirely sure of the culprit here because on a Unix machine the problem does not exist.  If you are encountering “Error 403: Forbidden” errors try this on a Windows host.

Options +FollowSymLinks

http://www.phpfreaks.com/forums/index.php?topic=159470.0;wap2

The resulting explanation seems fairly solid but it simply cannot be true if it is working on a host without that option.  So, I wonder then if the Unix host has that directive enabled by default in all Virtual Hosts.

Hrmm…