Jump to content


Photo

403 Error on ModReWrites


  • Please log in to reply
6 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 04 September 2006 - 12:56 PM

Hey
on My Localhost I have the following code in .htaccess

RewriteEngine On
Options FollowSymLinks
ReWriteRule ............

The dots being the rewrite rule

I know this is correct
but I am getting 403's (Forbidden)
if I comment the lines (add # at the front)
It works

Have I missed Something?

NOTE:
The root of the folder does not have an index page, as its my local machine, means I can just go to the root and click the file
if I navigate to a file, the file loads

Just the root dont.
Tell me the problem, I will try tell you the solution

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 01:37 PM

Post the actually Rewrite rule here so we can see if you do have the correct syntax.

Also make sure you have enabled the mod_rewrite module in Apaches configuration file (httpd.conf).

To enable the mod_rewrite module for Apache. Open the httpd.conf file for editing. Now look for the following:
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the hash (#) from the start of that line. Save httpd.conf and restart Apache.

Also if you are getting 403 forbidden it does appear something isn't right with your mod_rewrite rules/server configuration.

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 04 September 2006 - 03:10 PM

I have just added a ReWrite Rule to test, a bit stupid but it works

RewriteEngine On
Options FollowSymLinks

ReWriteRule ^register_me_on_site/ register.php [L]
if I go to
localhost/regiter_me_on_site/
it loads register.php as it should

So Mod ReWrites is working
but if i go to localhost/
then i get the 403 (NOTE: localhost should show directory, as there is no index page)
Tell me the problem, I will try tell you the solution

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 03:41 PM

This is a server config issue. Your server doesnt have the Indexes option in the Options direcive when you define the severs document root. Without this setting it can cause this. As it blocks access to see directory indexes.

if you have access to your servers httpd.conf file, open it up for editing and find the following:
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
    Options
After Options there'll probably be something like this after it:
FollowSymLinks Includes
Add Indexes to end of the list, making sure you put a space between the last option in the list. So its like this:
Options FollowSymLinks Includes Indexes

Save the httpd.conf and restart Apache. You should now be able to see the directory indexes. Read the manual for information on the Options directive

#5 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 04 September 2006 - 04:04 PM

Snippit from the conf file

<Directory "/www/">

# 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.0/mod/core.html#options
# for more information.

  Options Indexes Includes

# 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

God I really got to learn Apache
Tell me the problem, I will try tell you the solution

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 September 2006 - 04:33 PM

Well its not the configuration, but something I should of spotted earlier. Notice you have this:
Options FollowSymLinks
In your .htaccess
That is over riding whats in your httpd.conf. Add (space)Indexes after FollowSymLinks now try going to localhost/

So you .htaccess is this:
RewriteEngine On
Options FollowSymLinks Indexes

ReWriteRule ^register_me_on_site/ register.php [L]


#7 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 04 September 2006 - 04:43 PM

Excellent, cheers
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users