Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using cPanel and Apache, and I am seeing the following error in my error_log:

[Wed Feb 02 09:06:04 2011] [error] [client 110.34.4.242] client denied by server configuration: /home/websmart/public_html/.htaccess

My project is based on PHP 5.3 using the zend framework. My .htaccess file contains:

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 tell me what causes this error and how should I alter my .htaccess file to resolve this?

my webhost manager picture enter image description here

share|improve this question
    
do you have mod_rewrite enabled? –  Elzo Valugi Feb 2 '11 at 15:12
    
@Elzo Vaugi i dont know how to do this on server ... and also don't know how to check this on server. –  Santosh Linkha Feb 2 '11 at 15:13
    
check if you have a rewrite.conf in /etc/apache2/mods-enabled –  Elzo Valugi Feb 2 '11 at 15:16
    
@Elzo: if it's cPanel / WH, mod_rewrite is almost certainly on. –  Josh Feb 2 '11 at 15:17
    
@Elzo can i do that throught cpanel or WHM –  Santosh Linkha Feb 2 '11 at 15:17
add comment

1 Answer

up vote 3 down vote accepted

Check your options. You must have

Options +FollowSymLinks

to enable per-directory rewrite rules.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteRule

You may be able to put the "Options +FollowSymLinks" directive in the same .htaccess file, if your server-level config allows it. The server-level config must set the "AllowOverride" directive to "all" or it must contain "Options" or "Options=FollowSymLinks" to allow you to do this. See http://httpd.apache.org/docs/current/mod/core.html#allowoverride

So, at least try with this as your .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

If that doesn't work, you'll need to dig up your server config and modify the options there.

share|improve this answer
1  
+1 for dark reference in the manual –  lynxman Feb 2 '11 at 15:28
    
Ben i think you might be interested in my new Question serverfault.com/questions/230262/… –  Santosh Linkha Feb 2 '11 at 17:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.