Jump to content


[SOLVED] mod_rewrite/htaccess 403 error

  • Please log in to reply
2 replies to this topic

#1 socoljam

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 September 2007 - 03:28 PM

I'm having a problem with an .htaccess file and apparently mod_rewrite, hopefully someone here can offer some insight!

Basically, I'm trying to rewrite a short, pretty URL to a long, ugly URL. Here's the entire .htaccess file

# pretty url rewriting for online tutoring
#RewriteEngine on
#RewriteRule ^/onlinetutoring(/(.*))? /socol/onlinetutoring/index.php=$2 [L,QSA]

This is the .htaccess for my DocumentRoot (/home/web/public_html) directory.

The problem is this: as soon as I uncomment either line, I get 403 errors for every page on the server. Even if I only uncomment "RewriteEngine on" and not the rule, I get 403 errors everywhere.

Here's the relevant line of the ls -lhA

$ ls -lhA | grep htaccess
-rwxr-xr-x  1 root:web   162 Sep 14 11:25 .htaccess

Has anyone else encountered/solved this? If so, how?

Thanks in advance!

#2 socoljam

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 September 2007 - 06:25 PM


I would like very much if someone would explain why mod_rewrite requires

Options +FollowSymLinks

to be turned on.

#3 effigy

  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 14 September 2007 - 06:37 PM

From the docs:

Per-directory Rewrites

The rewrite engine may be used in .htaccess files. To enable the rewrite engine for these files you need to set "RewriteEngine On" and "Options FollowSymLinks" must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewrite engine. This restriction is required for security reasons.

When using the rewrite engine in .htaccess files the per-directory prefix (which always is the same for a specific directory) is automatically removed for the pattern matching and automatically added after the substitution has been done. This feature is essential for many sorts of rewriting; without this, you would always have to match the parent directory, which is not always possible. There is one exception: If a substitution string starts with http://, then the directory prefix will not be added, and an external redirect (or proxy throughput, if using flag P) is forced. See the RewriteBase directive for more information.

The rewrite engine may also be used in <Directory> sections with the same prefix-matching rules as would be applied to .htaccess files. It is usually simpler, however, to avoid the prefix substitution complication by putting the rewrite rules in the main server or virtual host context, rather than in a <Directory> section.

Although rewrite rules are syntactically permitted in <Location> sections, this should never be necessary and is unsupported.

Regexp | Unicode Article | Letter Database

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users