unemployment Posted November 2, 2012 Share Posted November 2, 2012 When I visit my URL of http://domain.com I get a directory listing files / folder in my /var/www directory structure. This does not happen when I go to http://www.domain.com Do you know why? Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/ Share on other sites More sharing options...
Christian F. Posted November 2, 2012 Share Posted November 2, 2012 I just get redirected to www. so I can't help you there. Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389684 Share on other sites More sharing options...
Jessica Posted November 2, 2012 Share Posted November 2, 2012 Christian, did you actually go to http://domain.com? I'm pretty sure the OP doesn't actually own domain.com. If he did, he'd probably know how DNS works. Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389686 Share on other sites More sharing options...
ManiacDan Posted November 2, 2012 Share Posted November 2, 2012 You need to set up your webserver to process PHP files properly, and also set up a default document. Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389687 Share on other sites More sharing options...
Jessica Posted November 2, 2012 Share Posted November 2, 2012 I guess the question is does OP see his site properly at the www url, or what? Because that's the impression I got, which would indicate he does have an index.php and php is working. Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389689 Share on other sites More sharing options...
Christian F. Posted November 2, 2012 Share Posted November 2, 2012 D'oh! You're right, Jessica. I didn't even look at what the domain was. So, before I go off for a (apparently, much needed) break. Could it be that the OP has two different configurations for the domains, one which uses "index.php" as a DirectoryIndex, and the other not? In any case, I'd set up a forwarding from http://domain.com to http://www.domain.com Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389696 Share on other sites More sharing options...
unemployment Posted November 2, 2012 Author Share Posted November 2, 2012 I guess the question is does OP see his site properly at the www url, or what? Because that's the impression I got, which would indicate he does have an index.php and php is working. Hey guys, the domain is actually http://trekeffect.com which shows the directory structure. The thing is... my personal site, http://jasonbiondo.com has no issues. I checked the virtual hosts and both of them have the same contents. What am I missing? Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389709 Share on other sites More sharing options...
unemployment Posted November 2, 2012 Author Share Posted November 2, 2012 One other thing to note is the when I do a dig on the www and without they both return the same IP Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389720 Share on other sites More sharing options...
ManiacDan Posted November 2, 2012 Share Posted November 2, 2012 So now your question has changed to "server A shows a file list, but server B shows a website." Check your server configs for default documents. Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389725 Share on other sites More sharing options...
ManiacDan Posted November 2, 2012 Share Posted November 2, 2012 Ok for real, you have to focus on one question or another. Is it two separate domains, or is it a question about adding the 'www' subdomain? Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389726 Share on other sites More sharing options...
unemployment Posted November 2, 2012 Author Share Posted November 2, 2012 Ok for real, you have to focus on one question or another. Is it two separate domains, or is it a question about adding the 'www' subdomain? The question is... going to http://trekeffect.com shows a server list but going to http://www.trekeffect.com shows the website, why? My virtual host file: <VirtualHost *:80> DocumentRoot /var/www/trekeffect.com/trekeffect.com ServerName www.trekeffect.com ServerAlias trekeffect.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride ALL Order allow,deny allow from all </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389734 Share on other sites More sharing options...
ManiacDan Posted November 2, 2012 Share Posted November 2, 2012 The apache man page shows the variables reversed: <VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389735 Share on other sites More sharing options...
unemployment Posted November 2, 2012 Author Share Posted November 2, 2012 The apache man page shows the variables reversed: <VirtualHost *:80> ServerName www.domain.tld ServerAlias domain.tld *.domain.tld DocumentRoot /www/domain </VirtualHost> That really shouldn't matter. I don't have this problem with pitchbig.com virtual host: <VirtualHost *:80> DocumentRoot /var/www/pitchbig.com/pitchbig.com ServerName www.pitchbig.com ServerAlias pitchbig.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride ALL Order allow,deny allow from all </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1389736 Share on other sites More sharing options...
txmedic03 Posted November 24, 2012 Share Posted November 24, 2012 (edited) <VirtualHost *:80> ServerAdmin hostmaster@trekeffect.com DocumentRoot /var/www/trekeffect.com/trekeffect.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/trekeffect.com/trekeffect.com> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorDocument 403 /errors/403.html ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html ServerName trekeffect.com ServerAlias *.trekeffect.com RewriteEngine on RewriteCond %{HTTP_HOST} !^(www).* [NC] RewriteCond %{HTTP_HOST} ^([^\.]+)\.([^\.]+)\.com RewriteCond /var/www/%2/%2/%1 -d RewriteRule ^(.*) /%1/$1 [L] </VirtualHost> Try this one on for size. Edited November 24, 2012 by txmedic03 Quote Link to comment https://forums.phpfreaks.com/topic/270212-when-i-visit-my-url-i-get-a-directory-of-files/#findComment-1394691 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.