onlyican Posted September 4, 2006 Share Posted September 4, 2006 Heyon My Localhost I have the following code in .htaccessRewriteEngine OnOptions FollowSymLinksReWriteRule ............The dots being the rewrite ruleI know this is correctbut I am getting 403's (Forbidden)if I comment the lines (add # at the front)It worksHave 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 fileif I navigate to a file, the file loadsJust the root dont. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 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. Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 4, 2006 Author Share Posted September 4, 2006 I have just added a ReWrite Rule to test, a bit stupid but it works[code]RewriteEngine OnOptions FollowSymLinksReWriteRule ^register_me_on_site/ register.php [L][/code]if I go tolocalhost/regiter_me_on_site/it loads register.php as it shouldSo Mod ReWrites is workingbut if i go to localhost/then i get the 403 (NOTE: localhost should show directory, as there is no index page) Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 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] Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 4, 2006 Author Share Posted September 4, 2006 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 Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Well its not the configuration, but something I should of spotted earlier. Notice you have this:[code]Options FollowSymLinks[/code]In your .htaccessThat 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 OnOptions FollowSymLinks IndexesReWriteRule ^register_me_on_site/ register.php [L][/code] Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 4, 2006 Author Share Posted September 4, 2006 Excellent, cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.