Jump to content

403 Error on ModReWrites


onlyican

Recommended Posts

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.
Link to comment
Share on other sites

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:
[code]#LoadModule rewrite_module modules/mod_rewrite.so[/code]
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.
Link to comment
Share on other sites

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

[code]
RewriteEngine On
Options FollowSymLinks

ReWriteRule ^register_me_on_site/ register.php [L]
[/code]
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)
Link to comment
Share on other sites

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:
[code]# 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[/code]
After Options there'll probably be something like this after it:
[code] FollowSymLinks Includes[/code]
Add Indexes to end of the list, making sure you put a space between the last option in the list. So its like this:
[code]Options FollowSymLinks Includes Indexes[/code]

Save the httpd.conf and restart Apache. You should now be able to see the directory indexes. Read the manual for information on the [url=http://httpd.apache.org/docs-2.0/mod/core.html#options]Options directive[/url]
Link to comment
Share on other sites

Snippit from the conf file

[code]
<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
[/code]

God I really got to learn Apache
Link to comment
Share on other sites

Well its not the configuration, but something I should of spotted earlier. Notice you have this:
[code]Options FollowSymLinks[/code]
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:
[code]RewriteEngine On
Options FollowSymLinks Indexes

ReWriteRule ^register_me_on_site/ register.php [L][/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.