Pretty Urls And Htaccess

I spent an hour trying to figure out what’s wrong with my new installation.

Every seo-friendly URL (/site/page) gave me 404. I knew that mod_rewrite is on and .htaccess is correct (copied that from another vhost).

Here’s the mistake:


DocumentRoot /some/path/example.com/htdocs

<Directory /some/path/exampl.com/htdocs>

    Options All

    AllowOverride All

</Directory>

Webroot is right, but AllowOverride is off because of stupid typo, so .htaccess does nothing.

Oh screw that, I need to sleep <_<

I had the same issue few days ago with site setup on EC2 with Ubuntu server.

The problem was that there is Apache 2.4 and my in my local setup it is Apache 2.2.

And recent Apache versions (from 2.3.9) have "AllowOverride None" by default and versions before had "AllowOverride All" (see allowoverride).

In addition to following the guide Using search engine and user friendly URLs, step by step, don’t forget the advice of ORey, that I solved on this way…

Most propably by your localhost apache configuration you need change the available sites in your host:

/etc/apache2/sites-available

In my case, just I have one web page in my localhost and for that one I used:


   

	<Directory "/var/www/yii/myAppWeb/protected">

    	Options [b]All[/b]

		AllowOverride [b]All[/b]

		[b]Require all granted[/b]

	</Directory>

Important: don’t forget restarting your apache server.