Skip to main content


Showing posts from May, 2013

Apache and mod_rewrite (and .htaccess) in Ubuntu

To enable mod_rewrite in Ubuntu, you just need to write this command in terminal

sudo a2enmod rewrite

Restart your your apache.

sudo service apache2 restart

After enabling mod_rewrite you can write .htaccess file for your web application.

CakePHP | URL Rewrites on IIS7 (Windows hosts / Azure)

IIS7 does not natively support .htaccess files. While there are add-ons that can add this support, you can also import htaccess rules into IIS to use CakePHP’s native rewrites. To do this, follow these steps:

1. Create a new file in your CakePHP root folder, called Web.config.
     /site/wwwroot/    or  /site/wwwroot/cakefolder/ or outside of your app   directory

2. Paste this rule to your Web.config.

<?xmlversion="1.0"encoding="UTF-8"?><configuration><system.webServer><rewrite><rules><clear/><rulename="Imported Rule 0"stopProcessing="true"><matchurl="^(img|css|files|js)(.*)$"></match><actiontype="Rewrite"url="app/webroot/{R:1}{R:2}"appendQueryString="false"></action></rule><rulename="Imported Rule 1"stopProcessing="true"><matchurl="^(.*)$"ignoreCase="false" /><conditionslogicalGr…