Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 /var/www/>
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all

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

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 ::1/128

share|improve this question

You have this in your .htaccess:

<IfModule mod_rewrite.c>

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


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

First, you should describe your condition and configuration clearly, so as not cause misunderstanding to know your condition and configuration.

Have you checked you phpinfo in Configuration > apache2handler > Loaded Modules there must be written mod_rewrite that show mod_rewrite enabled. If not, you should run this command:

sudo a2enmod rewrite

and then restart your apache:

sudo service apache2 restart

If you have done that things. Try to check your permission in your /var/www/. Usually, the 403 forbidden error means that your file has bad permissions, folders is set to 755 and files to 644.

share|improve this answer

Your Answer


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.