Forum Moderators: phranque

Message Too Old, No Replies

Apache configuration problems

Just installed it and want to configure it like my web server

         

richiebman

2:33 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



Hello. I've just binned IIS as I have started using mod_rewrite I read it's difficult to configure IIS to match what Apache can do.

So I've installed it and got PHP working, but I'm having difficulties getting it to work like it does with my web hoster's apache server. I've been fiddling with the httpd.conf file, but a lot of it is gibberish to me and I'm sure I'm missing something.

This is the .htaccess file that all works on my hosts server:

AddHandler cgi-script .wow
DirectoryIndex home.wow
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI}!/$
RewriteCond %{REQUEST_FILENAME}.wow -f
RewriteRule ^(.*) $1\.wow [L]
RewriteRule ^home_(.*)$ home?theme=$1
RewriteRule ^services_(.*)$ services?theme=$1
RewriteRule ^recent_work_(.*)$ recent_work?theme=$1
RewriteRule ^vision_(.*)$ vision?theme=$1
RewriteRule ^contact_(.*)$ contact?theme=$1
RewriteRule ^t_and_c_(.*)$ t_and_c?theme=$1

So I need to know what to change/add to my httpd.conf file to:
1. enable me to parse a random file extension (.wow) as php
2. get mod_rewrite working

What I have already altered in my httpd.conf file is:
a. activated
LoadModule rewrite_module modules/mod_rewrite.so
b. added
LoadModule php4_module "D:\PHP\php-4.3.6-Win32\sapi\php4apache2.dll"
AddType application/x-httpd-php .php
c. added
DirectoryIndex index.html index.html.var index.php home.php
d. added
Indexes ExecCGI
to
<Directory "D:/Program Files/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options Indexes ExecCGI
Order allow,deny
Allow from all
</Directory>

Also will I have to add anything else to my offline .htaccess file.

Thanks in advance,
R

richiebman

5:04 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



After further testing and I've found out that it is because my .htaccess files aren't acknowledged. I need to turn them on. I'll keep looking but if anyone knows the answer, that'd be great.

Cheers,
R

coopster

5:38 pm on Aug 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



A couple of directives to check in your
httpd.conf
file:

# 
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

richiebman

6:41 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



Coopster....you are a delight. I had the settings you posted apart from

AllowOverride All

The default was set at None.

My mod_rewrite stuff is going now, but can't get my .wow files to parse as php. I get a 403 error, with an additional 404. Any ideas?

Cheers again,
R

coopster

7:07 pm on Aug 23, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You're right, the default is
AllowOverride [httpd.apache.org] None
but you may want to click that link and read more before you set the value to
All
. I'm not saying you are at risk running your server that way but you really should read up on all that you are allowing at this point.


I'm guessing your host has PHP set up as CGI rather than as an Apache module?
AddHandler cgi-script .wow
Well, you shouldn't need the AddHandler [httpd.apache.org] directive. I noticed you are using a Windows installation and it looks like you are using PHP as an Apache module. Once that has been put into your
httpd.conf
or
.htaccess
file, any file containing the
.wow
extension will be treated as a CGI program.

Simply use an AddType and you will be able to parse pages with a

.wow
extension as PHP.
AddType application/x-httpd-php .wow

richiebman

10:02 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



Excellent Coopster. It's now working like my server, I just now have slightly different .htaccess files. I can live with that.

Cheers,
R