Ryanmcgrim Posted February 3, 2010 Share Posted February 3, 2010 Hi, I have just be given (told) that I will be the new in house website designer and manager for my company, and the kicker is, I have never created a website in my life. I am the type of person that reads as much on a subject as I can, and searches everything I can on forums before asking, but I am really overwhelmed here and stumped. I have almost the entire website designed, however I am trying to set up a local test server to actually use the live view feature of Dreamweaver cs4, and check to see if my database is working as it should. I have installed Wamp, and put all my site pages and info in the folder c:/wamp/www/mysite. However whenever I try to get to my index.php in the mysite subdirectory (http://localhost/mysite) I get a 500 Internal Server Error. I have troubleshooted this every way that I know how, however, I just can't seem to get the information that I need. Any insight would be greatly apprechiated. Could my company's SonicWall be causing the problem? Thanks, Ryan Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/ Share on other sites More sharing options...
roopurt18 Posted February 3, 2010 Share Posted February 3, 2010 Create file: c:/wamp/www/foo.txt Hello there! Browse to: http://localhost/foo.txt Does Hello there! display in your browser? Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006382 Share on other sites More sharing options...
Ryanmcgrim Posted February 3, 2010 Author Share Posted February 3, 2010 Yes it does Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006405 Share on other sites More sharing options...
roopurt18 Posted February 3, 2010 Share Posted February 3, 2010 Is there a file: c:/wamp/www/mysite/.htaccess If yes, post its contents here. Also, rename the .htaccess to foo.htaccess. Move foo.txt that we created earlier to c:/wamp/www/mysite/foo.txt Browse to http://localhost/mysite/foo.txt Does Hello there! still display? Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006409 Share on other sites More sharing options...
Ryanmcgrim Posted February 3, 2010 Author Share Posted February 3, 2010 Changing the filename allowed foo.txt to be viewed in /mysite directory Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006415 Share on other sites More sharing options...
Ryanmcgrim Posted February 3, 2010 Author Share Posted February 3, 2010 Is this an absolute path problem due to a local test server? Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006417 Share on other sites More sharing options...
roopurt18 Posted February 3, 2010 Share Posted February 3, 2010 Go ahead and put the .htaccess back where it was. A brief explanation. Apache is your web server. Apache has configuration information. Server wide configuration is stored in a file called httpd.conf; httpd.conf is loaded once when Apache starts. Additionally, Apache will look in directories for files named .htaccess. .htaccess files can contain additional configuration information that pertains to a directory and all directories below it. Your 500 internal server error is occurring because your .htaccess file is invalid. In .htaccess, lines starting with # are comments and are ignored by apache. Try the following: RewriteEngine on IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow #deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> # SECTION 1 #AuthName www.eggdonorinfo.com #AuthUserFile /home/eggdonor/public_html/_vti_pvt/service.pwd #AuthGroupFile /home/eggdonor/public_html/_vti_pvt/service.grp # SECTION 2 #RewriteCond %{HTTP_REFERER} !^$ #RewriteCond %{HTTP_REFERER} !^http://csedinc.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://csedinc.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://eggdonorinfo.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://eggdonorinfo.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://robertnicholsesq.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://robertnicholsesq.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.csedinc.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.csedinc.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.eggdonorinfo.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.eggdonorinfo.com$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.robertnicholsesq.com/.*$ [NC] #RewriteCond %{HTTP_REFERER} !^http://www.robertnicholsesq.com$ [NC] #RewriteRule .*\.(jpg|jpeg|gif|png|bmp|pdf)$ csedinc.com [R,NC] # SECTION 3 #RewriteCond %{HTTP_HOST} ^eggdonorinfo.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.eggdonorinfo.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] # SECTION 4 #RewriteCond %{HTTP_HOST} ^eggdonorboston.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.eggdonorboston.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] # SECTION 5 #RewriteCond %{HTTP_HOST} ^robertnicholsesq.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.robertnicholsesq.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] # SECTION 6 #RewriteCond %{HTTP_HOST} ^nicholsdelislelaw.com$ [OR] #RewriteCond %{HTTP_HOST} ^www.nicholsdelislelaw.com$ #RewriteRule ^/?$ "http\:\/\/www\.csedinc\.com" [R=302,L] What I've done there is commented out most of the file. I've left a little of it intact. If foo.txt will load correctly with that .htaccess file in place, then uncomment (by deleting the # marks) each section. Only uncomment one section at a time. Refresh foo.txt in your browser after uncommenting a section. This will tell you which sections of your .htaccess are giving apache problems. I'm guessing #SECTION 1 will bomb apache since it refers to file locations that do not exist on your windows machine. Sections 2 through 6 you should be able to uncomment safely. The line #deny from all (i.e. line 7) probably needs to be deleted altogether. Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006421 Share on other sites More sharing options...
roopurt18 Posted February 3, 2010 Share Posted February 3, 2010 When uncommenting a section, only uncomment the part following the line: # SECTION X If your .htaccess file has a line like this: SECTION 1 You'll receive the 500 error again since it's an invalid apache "command." Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006424 Share on other sites More sharing options...
Ryanmcgrim Posted February 3, 2010 Author Share Posted February 3, 2010 Ok, In order for me to not get a 500 server error, I had to add a # to the first line rewrite engine on. Then every section aside from the Deny line above section one cause it to crash. Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006430 Share on other sites More sharing options...
roopurt18 Posted February 3, 2010 Share Posted February 3, 2010 Ooops. You'll want to leave the: RewriteEngine on If rewriteengine is not on, then all of the RewriteCond and RewriteRule lines will cause a problem. Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006444 Share on other sites More sharing options...
Ryanmcgrim Posted February 4, 2010 Author Share Posted February 4, 2010 Ok, I think I found a fix for this, and would like to throw it up for others, and also to make sure I have not inadvertently disabled anything important. There are 2 troublesome lines in my .htaccess file. The Apache Error log says: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration pointed to a problem executing the "RewriteEngine On" command on the first line of my .htaccess file. The fix for this was to remove the # for the line: LoadModule rewrite_module modules/mod_rewrite.so in my httpd conf file. This solved the rewrite issue. Then I moved onto my .htcaccess file and began removing each # section to diagnose if there were any other problems going on. I was able to run the entire file aside from one line. The line reading: #RewriteRule .*\.(jpg|jpeg|gif|png|bmp|pdf)$ csedinc.com [R,NC] can't be run or else photos are not displayed on the site. I believe this is a security feature to prevent unauthorized use of photos, but I am not sure. Everything else is working well, and the test server is running as it should. Should I be concerned about this last line which can't be engaged? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006850 Share on other sites More sharing options...
roopurt18 Posted February 4, 2010 Share Posted February 4, 2010 Actually that last line is saying: .* -- Match any characters any number of times \. -- Match a single dot (jpg|jpeg|gif|png|bmp|pdf) -- Match any one of jpg, jpeg, gif, png, bmp, pdf $ -- Match the end of the line All of those essentially say match any request ending in .jpg, .jpeg, .gif, etc. csedinc.com -- Redirect to this location R,NC -- No redirect code specified, NC means no-case (or case insensitive) So the match would also match: .JPG, .PdF, etc So altogether the rule is saying any requests that look like images should go to http://csedinc.com (which loads an index page of some sort I'd guess, which is why the images are broken) There's common rules people place on image requests. I'm not sure what the intention of that rule is because it just blocks all images no matter who requests them. Essentially it's probably malformed. Quote Link to comment https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/#findComment-1006951 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.