OS X configuring Apache for new website: URL not found

5,778

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:
5,778
Rui
Author by

Rui

Updated on September 18, 2022

Comments

  • Rui
    Rui over 1 year

    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!

  • Kebman
    Kebman about 11 years
    AllOverride All will incur a performance hit as Apache will look for .htaccess files in all accessed directories.