Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to setup my confguration so I can develop a website to test an MVC architecture (based on this example). My problem is that I can only access my index.php if I dont specify any on the url. My website location is on /Users/[my user]/Projects/workspace/Spike and to avoid problems with permissions I've added a symbolic link /Library/WebServer/Documents/spike to point to the website folder mentioned above. I have also setup a new VirtualHost on httpd.conf with the following configuration:

<VirtualHost project1>
        ServerName project1
        DocumentRoot /Library/WebServer/Documents/spike
</VirtualHost>

I also added a new entry on /etc/hosts pointing project1 to 127.0.0.1. On my website root I have a .htaccess with the following content, which should be forwarding all request to my index.php file (right now containing only an echo "Hello World"):

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?request=$1 [L,QSA]

So, my problem is that if I try to access with "http://project1/" everything works ok. If I try to access with "http://project1/something" (and so on) I'll get the following error:

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

Can anyone help me out here? Many thanks in advance!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Your rewrite rules are ignored. You can access index.php directly, but not the files that don't actually exist, because their request paths aren't being rewritten.

You need to specify AllowOverride All in the web server configuration files (like httpd.conf), otherwise setting rewrite rules in .htaccess files is ignored.

The directive is usually there within all default <Directory ...> blocks, just set them from None to All. Restart Apache via System Preferences » Sharing and try again.

share|improve this answer
    
AllOverride All will incur a performance hit as Apache will look for .htaccess files in all accessed directories. –  Kebman Apr 17 '13 at 23:17

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.