Apache: The requested URL / was not found on this server. Apache

Viewed 216880

I've installed Apache 2.2 server and PHP 5.3 on Windows XP SP3. After the initial install, Apache loaded the test page, i.e.,

http:/localhost (C:/Program Files/Apache2.2/htdocs/index.html) showed "It works!".

After configuring Apache and installing PHP, trying to load http:/localhost/phptest.php i.e. (C:/testsite/htdocs/phptest.php).

But this throws an error:

Not Found. The requested URL /phptest.php was not found on this server.

I also get the same error now loading

http://localhost

httpd.conf edits:

ServerName localhost:80

DocumentRoot "C:/testsite/htdocs"

<Directory "C:/testsite/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

LoadModule php5_module "c:/testsite/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
PHPIniDir "C:/testsite/php"

File php.ini edits:

include_path = ".;C:\testsite\php\includes"
extension_dir = "C:/testsite/php/ext/"

System path:

The PHP directory was added to the Windows path, e.g.

PATH=C:\Windows\System32;C:\many_dir;C:\testsite\php

The only errors in the Apache error.log are:

Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2 /docs/dummy-host.localhost] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost] does not exist

The Apache service restarts successfully and is running. I can't find anything amiss. Can anyone spot any stupid errors?

4 Answers

In httpd.conf file you need to remove #

#LoadModule rewrite_module modules/mod_rewrite.so

after removing # line will look like this:

LoadModule rewrite_module modules/mod_rewrite.so

And Apache restart

Non-trivial reasons:

  • if your .htaccess is in DOS format, change it to UNIX format (in Notepad++, click Edit>Convert )
  • if your .htaccess is in UTF8 Without-BOM, make it WITH BOM.
Related