0

I have just installed xampp on a windows 7 os and downloaded my working web application into C:/xampp/htdocs/myweb

calling the website with localhost/myweb brings up the home page

try calling a specific page like localhost/myweb/about.html is redirected to localhost/xampp/

calling a specific page with localhost/myweb/index.php?include=about shows the correct page

I am suspecting the problem in the setup of apaches mode rewrite or virtual host.

Apache configuration in the above respect:

#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

<VirtualHost *:80>
   DocumentRoot "C:\xampp\htdocs"
   ServerName localhost
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot "C:\xampp\htdocs\myweb"
   ServerName myweb  
</VirtualHost>

Adding

 <Directory "C:\xampp\htdocs\myweb">
     AllowOverride all
     require local granted
 </Directory>

within the last VirtualHost as suggested in various posts stops Apache from starting.

The windows hosts file is modified as follows:

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
    127.0.0.1       myweb

    ::1             localhost
    ::1             myweb


127.0.0.1       localhost
127.0.0.1       myweb

Finally the .htaccess entry I am using:

RewriteEngine on                       
RewriteCond %{REQUEST_URI} /(.*).html  
RewriteRule (.*) /index.php?include=%1 

I am sure I missed something somewhere in the changes been made in the newer versions of php and apache. It would be great if some body could point me in the right direction

2
Contributors
5
Replies
62
Views
2 Years
Discussion Span
Last Post by Dieter_1
0

I am sure I missed something somewhere in the changes been made in the newer versions of php and apache.

No that's not it.. we can't blame the car manufacturer just because we forgot to put fuel.

I know there are some problems with xampp and windows 7 combination, but your issue is not one of them.

why not make it

127.0.0.1 myweb.local

or something that you like, even with .com.. so that you can access it like http://www/myweb.local .

Here how easy it is..

windows hosts file

 127.0.0.1 myweb.local

xampp's apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>
  ServerAdmin webmaster@myweb.local
  DocumentRoot C:\xampp\htdocs\myweb
  ServerName myweb.local
  ServerAlias www.myweb.local  *.myweb.local
  ErrorLog logs/myweb.local-error.log
  CustomLog logs/myweb.local-access.log common

<Directory "C:\xampp\htdocs\myweb">
  Options Indexes Includes
  AllowOverride All
  Require all granted
</Directory>

</VirtualHost>

restart your server and it should work.. try directing your browser to http://www/myweb.local .

When you do this

http://localhost/myweb/ 

you are not really using the myweb directives from both hosts and vhosts.conf, but rather you are using the directives for the localhost as the document root.

good luck to you.. this is a pretty simple tasks that should have been covered in basic web development courses.. just saying :).

and this one,

RewriteEngine on
RewriteCond %{REQUEST_URI} /(.*).html
RewriteRule (.*) /index.php?include=%1 

it only applies to the directory where it is contained except when it is located in the htdocs directory or above myweb directory. e.g. localhost/myweb/ or when doing localhost/myweb/..

Edited by veedeoo: more info added

0

Thanks for your reply, but exaxtly this configuration stops Apache from starting. It starts and shuts down with the following entries in the error log:

[Sun Nov 02 18:23:48.483086 2014] [ssl:warn] [pid 2516:tid 232] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 02 18:23:48.541089 2014] [core:warn] [pid 2516:tid 232] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sun Nov 02 18:23:48.784103 2014] [ssl:warn] [pid 2516:tid 232] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 02 18:23:48.827106 2014] [mpm_winnt:notice] [pid 2516:tid 232] AH00455: Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15 configured -- resuming normal operations
[Sun Nov 02 18:23:48.827106 2014] [mpm_winnt:notice] [pid 2516:tid 232] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Sun Nov 02 18:23:48.827106 2014] [core:notice] [pid 2516:tid 232] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache'
[Sun Nov 02 18:23:48.829106 2014] [mpm_winnt:notice] [pid 2516:tid 232] AH00418: Parent: Created child process 4080
[Sun Nov 02 18:23:49.496144 2014] [ssl:warn] [pid 4080:tid 244] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 02 18:23:49.772160 2014] [ssl:warn] [pid 4080:tid 244] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 02 18:23:49.818162 2014] [mpm_winnt:notice] [pid 4080:tid 244] AH00354: Child: Starting 150 worker threads.

0

can you show us the apache/extra/httpd-vhosts.conf

The first entry or virtual host should be the duplicate of the main host which is pretty much a shallow one similar to the one recorded on the apache/conf/httpd.conf file

and then followed by the child which is the myweb.local..

for more information about virtualization visit apache. You will have to read this docs sooner or later why not do it today.

0

forgot to add this.

normally the default xampp** httpd-vhosts.conf** don't have anything on it and it gives you something like this depending on the version of your xampp.

##<VirtualHost *:80>
##ServerAdmin webmaster@dummy-host.example.com
##DocumentRoot "C:/xamppserver/htdocs/dummy-host.example.com"
##ServerName dummy-host.example.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

BUT, that is not going to work because that is for a child directive and we need to add

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>

## you add the new virtual hosts here

if you look at the entry in the apache/conf/httpd.conf you will find similar entry

0

can you show us the apache/extra/httpd-vhosts.conf

can you show us the apache/extra/httpd-vhosts.conf

The vhosts config was originaly empty as:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

I have done the additions as suggested and now it looks like:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@myweb.loc
    DocumentRoot C:/xampp/htdocs/myweb
    ServerName myweb.loc
    ServerAlias www.myweb.loc *.myweb.loc
    ErrorLog logs/myweb.loc-error.log
    CustomLog logs/myweb.loc-access.log common

    <Directory "C:/xampp/htdocs/myweb">
        Options Indexes Includes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Apache does starts now. However, It still does not rewrite the urls as it should.

The htaccess file is locatet in the folder myweb.

Again, passing the url like localhost/myweb/index.php?include=whateverpage
brings up the correct page.

passing the url like localhost/myweb/whateverpage.html ends ab again at the xampp entrypage.

entering localhost/myweb.loc ends up with a 404 error (Object not found)

and entering http://myweb.loc finishes with a 403 Forbidden error.

Thanks again for some advice.

Edited by Dieter_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.