Jump to content


Photo

[SOLVED] mod_rewrite/htaccess 403 error


  • Please log in to reply
2 replies to this topic

#1 socoljam

socoljam

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 14 September 2007 - 10:28 AM

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!
~james

#2 socoljam

socoljam

    Newbie

  • New Members
  • Pip
  • 2 posts

Posted 14 September 2007 - 01:25 PM

Solved!

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

Options +FollowSymLinks

to be turned on.

#3 effigy

effigy

    Advanced Member

  • Staff Alumni
  • 3,600 posts
  • LocationIL

Posted 14 September 2007 - 01: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
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com