Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My problem is : when i create .htaccess file my browser shows 403 Forbidden my htaccess code is

Options SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(img|css|port/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)$ index.php?page=$1&id=$2 [L]

My rewrite mod is enable index.php exists where is the problem. When i delete or rename htaccess the problem is gone this is my config ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride All

</Directory>
<Directory /var/www/>
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride All
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

share|improve this question
add comment

1 Answer

You have this in your .htaccess:

<IfModule mod_rewrite.c>

but you don't (or didn't post) a matching

</IfModule>

Also, you can look in Apache's error logs (usually /var/log/apache/error.log) for more detailed information about the 403 error you're seeing. If you can't figure out what the problem is from the error logs, you can add the lines with errors to your question and we can help see what's wrong.

share|improve this answer
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.