Forum Moderators: phranque

Message Too Old, No Replies

Problem with mod rewrite, tried all the usual steps

         

andy120

6:46 pm on Jun 4, 2009 (gmt 0)

10+ Year Member



Apache/2.2.3 (CentOS) Server

My .htaccess file has the line "RewriteEngine on" but it doesn't work.

I read I'd have to change "AllowOverride None" to "AllowOverride All" in httpd.conf in order for the command in .htaccess to enable rewrite. However, when I change allowoverride to all I get 403 forbidden error on any page I try to access (even those without mod_rewrite in the URL). If I turn it back to none, the regular URLs work, but not those that need mod_rewrite.

I spent hours working on this one bug, and I don't know what else to do. :confused:

Below are the relevant parts of my httpd.conf and .htaccess files:

<Directory "/var/www/html">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

# Options +Indexes +FollowSymLinks
# Options Indexes FollowSymLinks

RewriteEngine On
# RewriteBase /

# -FrontPage-
RewriteEngine on

<Files *.tpl>
order allow,deny
deny from all
</Files>

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>


Help is greatly appreciated!

jdMorgan

11:22 pm on Jun 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I read I'd have to change "AllowOverride None" to "AllowOverride All"

Be wary of what you read... You need to set "AllowOverride FileInfo" for mod_rewrite to work, and you need to set "AllowOverride Options" if you want to change any options in your .htaccess file(s). Note that in the Apache server module documentation, each directive's summary states what Override(s) it requires for use in .htaccess.

When you get one of these 403 errors, what shows in your server log file.

Can't offer much more, since no actual rewrite rule examples with the URL-paths they are intended to apply to have been posted.

Jim