Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/190834-stumped-creating-a-testing-server/
Share on other sites

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?

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.

 

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."

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

 

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.