Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am working on a PHP laravel project. I am currently facing issues with .htaccess file. I have following .htaccess:

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

When I reload my page the it gave me following error:

404 Not Found

The requested URL /contacts was not found on this server.

Then I opened /etc/apache2/users/username.conf file which had following line of code:

<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

In above code I changed AllowOverride None to AllowOverride All. Then I reload page and got following error:

403 Forbidden

You don't have permission to access /contacts on this server.

When I add FollowSymLinks to .htaccess file Options such as like this Options -MultiViews FollowSymLinks. Then sometimes I get this 500 Internal Server Error error and sometime this *Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data*. Each time I reload my page one of these errors with FollowSymLinks option.

I also uncomment following lines in /etc/apache2/httpd.conf:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

and still I am getting same permission denied error.

Please help me I am trying to solve this problem for past 3 days but it is till unresolved.

share|improve this question
    
Can anyone help me out? Please help –  x4ph4r Jan 25 '13 at 15:43
add comment

3 Answers

I think you want to remove the .php extension, so I'll give the .htaccess code to accomplish that:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

That should be located in the root directory.

So suppose there is a file in the root folder named index.php, you can then access it at: site/index. And if there is a folder called contact with a file in it called contactnow, then you can access it at: site/contact/contactnow

I hope you understood how this code works.

share|improve this answer
add comment

Please verify if /contacts exists with a folder permission of 755. The files under /contacts should have a permission of 644.

Also rename your current .htaccess file and create a new .htaccess file with the following code.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Also, set Allowoverride as None in the .conf file.

share|improve this answer
add comment

403 Forbidden You don't have permission to access /contacts on this server

Ensure that folders Users, username and Sites are chmod 755

chmod -R 755 /home
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.