Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Please help: The .htaccess is causing a 403 error |
|
Author |
|
mOrloff
Joined: 05 May 2011 Posts: 5 Location: Pacific NW, USA
|
Posted: Thu 05 May '11 0:27 Post subject: Please help: The .htaccess is causing a 403 error |
|
|
I've been struggling with this 403 error for a full week now, and I've finally found the root of my problem (I am sooo excited!!).
I'm running WAMP on Win XP, and the problem is my .htaccess file.
What a relief!
I'm totally green on Apache(and I'm trying to learn zend FW). I'm trying to follow a set of tutorials, but when I create a project, I can't see it from my browser.
I get a 403 error: Forbidden You don't have permission to access / on this server .
When I arbitrarily rename the .htaccess file, I can suddenly browse into the public directory (even if with: "Fatal error: require_once() [function.require]: Failed opening required ...").
Here are the contents of that default .htaccess file:
Code: |
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
|
Can anyone see what would be causing the 403 error?
I'd really appreciate some help on this
Thanks-a-bunch,
~ Mo
For posterity sake (adding more content for future searches), here's the big picture:
I tried a million things. From creating the projects multiple ways (from the command line and from within netBeans) in many different locations on several different drives (I learned that wamp doesn't like it when a VH dir is on a mapped network drive), to playing with the httpd-vhosts.conf file, to wrestling with windows permissions(which, by the way, has some black-magic-voodoo going on with it's psuedo-readOnly attribute), to ... so many other things I can't remember them all right now .
Finally, I tried to just create an alias to the parent directory of one of my many ZF test projects, and I could see all sub-dir's except for public. So, through a process of elimination, I came to pin down the culprit. Oh, what a relief !! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7294 Location: Germany, Next to Hamburg
|
Posted: Thu 05 May '11 10:49 Post subject: |
|
|
it seems there is an issue with your index.php. I can use your .htaccess file without any limitations.
What is in your error log about this? |
|
Back to top |
|
mOrloff
Joined: 05 May 2011 Posts: 5 Location: Pacific NW, USA
|
Posted: Thu 05 May '11 17:40 Post subject: |
|
|
I don't recall making any modifications since submitting this post, but I must have because, now, instead of getting a 403 error, I'm getting "Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. ...".
As you suggested, I tried a different index page. Its entire contents consist of: Code: | <?php echo 'testing, testing, 1, 2, 3.'; ?> |
If I remove the .htaccess file, I go straight to that test page.
Replacing the .htaccess file sends me right back to that server error again.
Logs:
I first looked at my access log, which says Quote: | 127.0.0.1 - - [05/May/2011:08:10:38 -0700] "GET /index.php HTTP/1.1" 500 535 |
Hmmm ... ok That doesn't mean much to me ~:o)
(I mean, I know what the 500 code means (thanks to google), but as for what to do with it, or what that 535 means, I'm at a loss )
Then I looked at my apache log which says Quote: | [Thu May 05 08:10:38 2011] [alert] [client 127.0.0.1] C:/temp/HelloWorld/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration |
Ahah! Now we're getting somewhere!
(btw, the apache log wasn't showing anything when I was getting the 403 code.)
Do you spot what's wrong with that ?
Thanks-a-bunch,
~ Mo |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 05 May '11 23:07 Post subject: |
|
|
Is mod_rewrite loaded?
If FileInfo one of the Allowed overrides for the directory? |
|
Back to top |
|
mOrloff
Joined: 05 May 2011 Posts: 5 Location: Pacific NW, USA
|
Posted: Fri 06 May '11 0:13 Post subject: |
|
|
Hmm ... mod-rewrite ????
Is that an Apache extension, or ???? ?
If so, where do I find whether it's loaded?
Sorry for my naivety, but I am pretty new to all this
In case it helps, I'd just like to remind that I'm running wamp on winXP.
Quote: |
If FileInfo one of the Allowed overrides for the directory? |
Can you ask this a different way? I don't want to make any assumptions, and don't understand the question
Thank you so much.
~ Mo |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 06 May '11 0:34 Post subject: |
|
|
Yes mod_rewrite is an Apache module/extension. In httpd.conf file it will be in the LoadModule section of that file. Make sure is is not commented out (usually the default).
I understand, I just typo'd. If = Is
AllowOverrides. To use RewriteRule, RewriteEngine, etc. in a .htaccess file it must be allowed to be in there. It is easy to look at the docs and see what is needed for any directive, the context of where it can be placed and so on.
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteengine
Description: Enables or disables runtime rewriting engine
Syntax: RewriteEngine on|off
Default: RewriteEngine off
Context: server config, virtual host, directory, .htaccess tells you where it is allowed.
Override: FileInfo If an Override is needed to use it in .htaccess files and what it is.
Status: Extension
Module: mod_rewrite If a module must be loaded to use this Directive.
Some other reading is still needed IMO. This explains the Overrides (overriding the configuration of a location with .htaccess).
http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride |
|
Back to top |
|
mOrloff
Joined: 05 May 2011 Posts: 5 Location: Pacific NW, USA
|
Posted: Fri 06 May '11 14:35 Post subject: |
|
|
Thanks-a-bunch.
I'll run with that new info, and post my results.
~ Mo |
|
Back to top |
|
mOrloff
Joined: 05 May 2011 Posts: 5 Location: Pacific NW, USA
|
Posted: Mon 09 May '11 17:27 Post subject: |
|
|
Oh, um, btw glsmith, you're awesome
I'm just checking in to let you know that mod_rewrite was the ticket.
I did in fact get me past that hurdle.
I have successfully gained access to the next level of errors
(they're just php errors, so I think I can work through those ones myself .)
Again, thanks for your help, and thanks for the links.
~ Mo |
|
Back to top |
|
|
|
|
|
|