Jump to content

[SOLVED] URL Loading Directory Page


Drace

Recommended Posts

Hey Folks,

I'm currently working in conjunction with Cascade on setting up a server using Apache 2.2.x, I have my virtual host set up like so:
[code]<VirtualHost www.paranoiaonline.co.uk:80>
DocumentRoot /Apache2.2/htdocs/pwd/
ServerName Paranoia Web Design
ServerAdmin ben_wake@hotmail.co.uk
</VirtualHost>[/code]

However, when I type my url:[url=http://www.paranoiaonline.co.uk]www.paranoiaonline.co.uk[/url] I get the servers index page of all directories hosted on that server and not the index page in my document root.

I've figured out that to get to my website I have to type this url [url=http://www.paranoiaonline.co.uk/pwd]www.paranoiaonline.co.uk/pwd[/url], I was wondering if there is a way round this, or am I going to have to post my url with "/pwd" at the end of it????

Also some people when trying to view my site and I know they have the correct url, well it works for me and several other people, they receive a 404 error saying the page cannot be found, is this linked with the same problem or is this something else?


As you can tell I'm new to this..

Any help is greatly appreciated,

Drace
Link to comment
Share on other sites

Sounds to me you have your virtual hosts setup wrong...

I see one error in your vhost setup already... Your ServerName directive should be a URL [url=http://httpd.apache.org/docs/2.2/mod/core.html#servername]ServerName directive[/url]!

If you have more then one vhost maybe you should use name based vhosts...
Link to comment
Share on other sites

I changed the ServerName directive to my url is this correct or am I totally screwing this up...?

this is the code now:

[code]
<VirtualHost www.paranoiaonline.co.uk:80>
DocumentRoot /Apache2.2/htdocs/pwd/
ServerName www.paranoiaonline.co.uk
ServerAdmin ben_wake@hotmail.co.uk
</VirtualHost>
[/code]

Any suggestions?

however after changing this, I still get the same issue
Link to comment
Share on other sites

So maybe.... Just maybe...

In http.conf you configured your document root for "/Apache2.2/htdocs/"

I don't see how you can want two or three different sites on just one URL...

Not sure if this will help you but... Here is an example of my vhost conf...

[code]#
#
# $---> Section 1: HTTP Virtual Host Configuration <---$
#
#
# For Name Based Virtual Hosts
NameVirtualHost *
#
<VirtualHost *>
  ServerName www.critical-damage.com
  ServerAlias critical-damage.com
  DocumentRoot "/Web stuff/Local site/www/non-secure/cdi"
  CustomLog "/Web stuff/Local site/logs/Apache/http-access-CDI.log" cdi env=!dontlog
  #CustomLog "/Web stuff/Local site/logs/Apache/image-access-CDI.log" cdi env=imagelog
  # Rewrite Module Stuff #
  <IfModule mod_rewrite.c>
      Include "conf/extra/httpd-rewrite.conf"
      RewriteEngine on
      RewriteCond %{SERVER_NAME} !critical-damage.com [NC,OR]
      RewriteCond %{SERVER_NAME} !www.critical-damage.com [NC]
      RewriteRule (.*) http://www.critical-damage.com [NC,R,L,E=dontlog:1]
  </IfModule>
</VirtualHost>
#
<VirtualHost *>
  ServerName love.critical-damage.com
  DocumentRoot "/Web stuff/Local site/www/non-secure/love"
  CustomLog "/Web stuff/Local site/logs/Apache/http-access-LOVE.log" cdi env=!dontlog
  #CustomLog "/Web stuff/Local site/logs/Apache/image-access-LOVE.log" cdi env=imagelog
  # Rewrite Module Stuff #
  <IfModule mod_rewrite.c>
      Include "conf/extra/httpd-rewrite.conf"
      RewriteEngine on
      RewriteCond %{SERVER_NAME} !love.critical-damage.com [NC]
      RewriteRule (.*) http://www.critical-damage.com [NC,R,L,E=dontlog:1]
  </IfModule>
</VirtualHost>
#
<VirtualHost *>
  ServerName www.critical-damage.local
  DocumentRoot "/Web stuff/Local site/www/local"
  CustomLog "/Web stuff/Local site/logs/Apache/http-access-local.log" cdi env=!dontlog
  # Rewrite Module Stuff #
  <IfModule mod_rewrite.c>
      Include "conf/extra/httpd-rewrite.conf"
      RewriteEngine on
      RewriteCond %{SERVER_NAME} !critical-damage.local [NC]
      RewriteRule (.*) http://www.critical-damage.com [NC,R,L,E=dontlog:1]
  </IfModule>
</VirtualHost>
#
#
#
# $---> Section 2: HTTPS Virtual Host Specifics <---$
#
#
#<VirtualHost *:443>
#  ServerName secure.critical-damage.com
#  DocumentRoot "/Web stuff/Local site/www/secure"
#  CustomLog "/Web stuff/Local site/logs/Apache/https-access.log" ssl env=!dontlog
#  SSLEngine on
#  SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
#  SSLCertificateFile conf/Certificates/secure.critical-damage.com.cert
#  SSLCertificateKeyFile conf/Keys/secure.critical-damage.com.key
#  <Files ~ "\.(cgi|shtml|phtml|php3?)$">
#      SSLOptions +StdEnvVars
#  </Files>
#  <Directory "/Web stuff/Local site/www/secure">
#      SSLOptions +StdEnvVars
#  </Directory>
#  SetEnvIf User-Agent ".*MSIE.*" \
#            nokeepalive ssl-unclean-shutdown \
#            downgrade-1.0 force-response-1.0
#  # Rewrite Module Stuff #
#  <IfModule mod_rewrite.c>
#      Include "conf/extra/httpd-rewrite.conf"
#      RewriteEngine on
#      RewriteCond %{SERVER_NAME} !secure.critical-damage.com [NC]
#      RewriteRule (.*) https://secure.critical-damage.com [NC,R,L,E=dontlog:1]
#  </IfModule>
#  # This Is For No Cache #
#  <IfModule mod_cache.c>
#      CacheDisable /
#  </IfModule>
#  <IfModule mod_security.c>
#      # Accept almost all byte values
#      SecFilterForceByteRange 1 255
#  </IfModule>
#</VirtualHost>

[/code]
Link to comment
Share on other sites

I dont want to have multiple sites using one url, i want multiple sites hosted on this particular server, I'm trying to eradicate this index page which shows al ist of directories and my document root is set to htdocs in the httpd file, so any ndeas??
Link to comment
Share on other sites

[quote author=Drace link=topic=121040.msg498126#msg498126 date=1168092394]
I dont want to have multiple sites using one url, i want multiple sites hosted on this particular server
[/quote]

This confused me a bit... You need one URL per site, either a root URL (www.paranoiaonline.co.uk) or a subdomain URL (cascade.paranoiaonline.co.uk)

[quote author=Drace link=topic=121040.msg498126#msg498126 date=1168092394]
I'm trying to eradicate this index page which shows al ist of directories and my document root is set to htdocs in the httpd file, so any ndeas??
[/quote]

Thats why you see the directory listing, your document root is set to htdocs in httpd.conf.

You can serve many sites from one server but they need a URL each like said above... Something like this maybe...

[code]#
#
# $---> Section 1: HTTP Virtual Host Configuration <---$
#
#
# For Name Based Virtual Hosts
NameVirtualHost *
#
<VirtualHost *>
  ServerName www.paranoiaonline.co.uk
  ServerAlias paranoiaonline.co.uk
  DocumentRoot "/Apache2.2/htdocs"
</VirtualHost>
#
<VirtualHost *>
  ServerName cascade.paranoiaonline.co.uk
  DocumentRoot "/Apache2.2/htdocs/cascade"
</VirtualHost>
#
<VirtualHost *>
  ServerName pwd.paranoiaonline.co.uk
  DocumentRoot "/Apache2.2/htdocs/pwd"
</VirtualHost>
#[/code]

Maybe I am not understanding what you want, in that case I apologize.  :-[

Edit:
Are you trying to get www.paranoiaonline.co.uk to point to this site http://www.paranoiaonline.co.uk/pwd/ ? If thats all your trying to do change your document root in you httpd.conf file to point to "/Apache2.2/htdocs/pwd" Remember if you change core files you must restart Apache!

Hope this helps!
Link to comment
Share on other sites

each particular site is the directory listing, for example, www.paranoiaonline.co.uk is the /pwd directory, www.cascade-online.com is the /cascade directory etc.

So if i was to edit the httpd.config file and take out the document root and left it simply to the VH i should remove this problem?

the reason why we want to host so many sites is because i do web design for a few friends etc...
[code]
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"[/code], so should i remove this from the httpd file then? and leave the VH as they are???
Link to comment
Share on other sites

Okay change the document root in httpd.conf to...

[code]DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd"[/code]

This will be your vhost section...

[code]#
#
# $---> Section 1: HTTP Virtual Host Configuration <---$
#
#
# For Name Based Virtual Hosts
NameVirtualHost *
#
<VirtualHost *>
  ServerName www.paranoiaonline.co.uk
  ServerAlias paranoiaonline.co.uk
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/pwd"
</VirtualHost>
#
<VirtualHost *>
  ServerName www.cascade-online.com
  ServerAlias cascade-online.com
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cascade"
</VirtualHost>
#[/code]

Adding any other things you want like ServerAdmin directive, CustomLog directive, & so on!  ;D
Link to comment
Share on other sites

Nope.  ;)

Edit:
All the rest would go in the vhost section. If you created another site just add it to the vhost section!

Also you need to add .htm to the end of your DirectoryIndex directive cause I noticed if I click on cascade in you directory listing the index page does not show cause .htm is not put there by default.
Link to comment
Share on other sites

Ive changed the document root as you suggested and copied what you also suggested for the virtual hosts, however when i type just www.paranoiaonline.co.uk, I still get the directory listing for the server..and not the index page for www.paranoiaonline.co.uk which can be found at [url=http://www.paranoiaonline.co.uk/pwd]www.paranoiaonline.co.uk/pwd[/url]
Link to comment
Share on other sites

It should be like this...
[code]DirectoryIndex index.html index.htm[/code]

If you use php or asp you can add that also... You can use anything you want to use as an index page...

Like so...
[code]DirectoryIndex index.html index.htm index.php index.asp[/code]

;)
Link to comment
Share on other sites

added the index page file types, but theres still the issue of the whole directory index, and I don't know about you but its doing my head in, but ah well, like i said ive done all that was suggested and will no avail, any other ideas?? ??? :-\ :'(

Drace
Link to comment
Share on other sites

For some reason it works now,when i type www.paranoiaonline.co.uk, i get the correct index page, however, one step forward, two steps back!, when i type "www.gamingsearch.co.uk/cheats" i got a 404 error, and then when i try it without the "/cheats" on the end I'm served with the paranoiaonline.co.uk site...help????
Link to comment
Share on other sites

Right lets see if i can be a bit clearer than my last post was..

I have the virtual hosts and DocumentRoot set as suggested, and the paranoiaonline.co.uk site works fine, however when trying to get to the other sites hosted, for example, www.cascade-online.com, im served with the Paranoiaonline site, am i doing something wrong or is there something im missing???
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.