Hi,
We're re-structuring a site and I need to make our 404 page intelligent -
use the requested URL and search params to re-direct the visitor to the
replacement page. ErrorDocument 404 /404.cfm is invoking the 404 script, but
CF's not seeing any useful CGI variables.
The Apache manuals say "Redirecting to another URL can be useful, but only
if some information can be passed which can then be used to explain and/or
log the error/problem more clearly. To achieve this, Apache will define new
CGI-like environment variables, e.g. .... At least REDIRECT_URL and
REDIRECT_QUERY_STRING will be passed to the new URL (assuming it's a
cgi-script or a cgi-include)." But my CF code is getting empty strings in
CGI.REDIRECT_URL and CGI.REDIRECT_QUERY_STRING and these variables are not
listed at all in my CF debug output.
My development set-up uses Apache under Windows. Here's the Apache
configuration for my development set-up (all in Apache\conf\httpd.conf, no
.htaccess). Sorry for the length - I include all of it so you can see if
I've made any mistakes. I guess the most important part is the Virtual Hosts
section at the bottom.
# Standard stuff copied from supplied default config with a few
adjustments - I've even
# kept the directives which are commented out in the default config.
ServerType standalone
ServerRoot "C:/Program Files/Apache"
PidFile logs/httpd.pid
ScoreBoardFile logs/apache_status
#ResourceConfig conf/srm.conf
#AccessConfig conf/access.conf
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxRequestsPerChild 0
ThreadsPerChild 50
#Listen 3000
#Listen 12.34.56.78:80
#BindAddress *
# Default config's LoadModule directives remain commented out.
LoadModule coldfusion_module modules/ApacheModuleColdFusion.dll
#ExtendedStatus On
Port 80
ServerAdmin [nospam]
ServerName phil
ServerName 127.0.0.1
ServerName localhost
DocumentRoot "C:/Program Files/Apache/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "C:/Program Files/Apache/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
</Directory>
UserDir "C:/Program Files/Apache/users/"
DirectoryIndex index.html index.htm index.cfm
AccessFileName .htaccess
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
#CacheNegotiatedDocs
# No UseCanonicalName setting
TypesConfig conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access.log common
#CustomLog logs/referer.log referer
#CustomLog logs/agent.log agent
#CustomLog logs/access.log combined
ServerSignature On
Alias /icons/ "C:/Program Files/Apache/icons/"
ScriptAlias /cgi-bin/ "C:/Program Files/Apache/cgi-bin/"
<Directory "C:/Program Files/Apache/cgi-bin">
AllowOverride None
Options None
</Directory>
# No Redirect directives
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
# Default AddIconByType directives - omitted out here to save space.
# Default AddIcon directives - omitted out here to save space.
DefaultIcon /icons/unknown.gif
# No AddDescription directive.
ReadmeName README
HeaderName HEADER
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage en .en
# And other AddLanguage directives straight out of the box.
LanguagePriority en da nl et fr de el it pt ltz ca es sv
AddType application/x-tar .tgz
# No active AddHandler directives.
# No active Action directives.
# No active MetaDir / MetaSuffix directives.
# No global ErrorDocument directives, see below for Virtual Hosts.
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
# No active <Location /server-status>, <Location /server-info> or
</Location>
#ProxyRequests On
#ProxyVia On
# No active Cache... directives.
#
# MY VIRTUAL HOSTS
#
# c:windows/hosts must define all ServerName values:
# 127.0.0.1 localhost mydev mylive
# Alias doesn't work in DocumentRoot - must spell out physical path.
NameVirtualHost 127.00.00.01
# localhost - for Apache's own use and CF.
# Change all CF Start Menu entries to use localhost instead of 127.00.00.01
<VirtualHost 127.00.00.01>
ServerName localhost
# DocumentRoot default set above
DirectoryIndex index.htm index.html index.cfm
</VirtualHost>
# Development "site"
<VirtualHost 127.00.00.01>
ServerName mydev
DocumentRoot e:/web-development/site-01/development/
DirectoryIndex index.htm index.cfm
ErrorDocument 404 /error404.cfm
</VirtualHost>
# Copy of live site
<VirtualHost 127.00.00.01>
ServerName mylive
DocumentRoot e:/web-development/site-01/copy-live/
DirectoryIndex index.htm index.cfm
ErrorDocument 404 /error404.cfm
</VirtualHost>
What am I dong wrong?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.804 / Virus Database: 546 - Release Date: 30/11/04
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:10:5065
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/10
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:10
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.10
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54