- <VirtualHost my.domain.com:80>
- ServerName my.domain.com
- DocumentRoot /path/to/server/root/my.domain.com/public
- RewriteEngine off
- <Location />
- RewriteEngine On
- RewriteCond %{REQUEST_FILENAME} -s [OR]
- RewriteCond %{REQUEST_FILENAME} -l [OR]
- RewriteCond %{REQUEST_FILENAME} -d
- RewriteRule ^.*$ - [NC,L]
- RewriteRule ^.*$ /index.php [NC,L]
- </Location>
- </VirtualHost>
Programmer's Reference Guide
| Module Structure |
Rewrite Configuration Guide
URL rewriting is a common function of HTTP servers. However, the rules and configuration differ widely between them. Below are some common approaches across a variety of popular web servers available at the time of writing.
Apache HTTP Server
All examples that follow use mod_rewrite, an official module that comes bundled with Apache. To use it, mod_rewrite must either be included at compile time or enabled as a Dynamic Shared Object (DSO). Please consult the » Apache documentation for your version for more information.
Rewriting inside a VirtualHost
Here is a very basic virtual host definition. These rules direct all requests to index.php, except when a matching file is found under the document_root.
Note the slash ("/") prefixing index.php; the rules for .htaccess differ in this regard.
Rewriting within a .htaccess file
Below is a sample .htaccess file that utilizes mod_rewrite. It is similar to the virtual host configuration, except that it specifies only the rewrite rules, and the leading slash is omitted from index.php.
- RewriteEngine On
- RewriteCond %{REQUEST_FILENAME} -s [OR]
- RewriteCond %{REQUEST_FILENAME} -l [OR]
- RewriteCond %{REQUEST_FILENAME} -d
- RewriteRule ^.*$ - [NC,L]
- RewriteRule ^.*$ index.php [NC,L]
There are many ways to configure mod_rewrite; if you would like more information, see Jayson Minard's » Blueprint for PHP Applications: Bootstrapping.
Microsoft Internet Information Server
As of version 7.0, IIS now ships with a standard rewrite engine. You may use the following configuration to create the appropriate rewrite rules.
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="Imported Rule 1" stopProcessing="true">
- <match url="^.*$" />
- <conditions logicalGrouping="MatchAny">
- <add input="{REQUEST_FILENAME}"
- matchType="IsFile" pattern=""
- ignoreCase="false" />
- <add input="{REQUEST_FILENAME}"
- matchType="IsDirectory"
- pattern=""
- ignoreCase="false" />
- </conditions>
- <action type="None" />
- </rule>
- <rule name="Imported Rule 2" stopProcessing="true">
- <match url="^.*$" />
- <action type="Rewrite" url="index.php" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
| Module Structure |
Add A Comment
Please do not report issues via comments; use the ZF Issue Tracker.
If you have a JIRA/Crowd account, we suggest you login first before commenting.

Comments
I had to add a new rule to treat de files (js|ico|gif|jpg|png|css|swf) here it is:
<rule name="CSS Rule " stopProcessing="true">
<match url="^\.(js|ico|gif|jpg|png|css|swf)$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}"
matchType="IsFile" pattern="\.(js|ico|gif|jpg|png|css|swf)$"
ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
For me this resolved the problem of supporting files of my application.
I hope you enjoy.
Now You have two options:
Download Helicon URL Rewrite Software (http://www.helicontech.com/isapi_rewrite/)
or
Download the x86 version of the URL Rewrite native module (http://go.microsoft.com/?linkid=9722533)
I tried both and, for me microsoft works better and rules are easy to understand.
I hope this can help someone like me to save my lost 3 days searching for a solution!!!
Zend framework 1.10
PHP 5.3
MySQL:5.5
Server: IIS 5.1(WinXP)
The problem in rewriting rule
on apache with htaccess no problem
but the problem in IIS
I try using Isapirewrite4 but seems not work
always is giving me this message:
The page cannot be diplayed
Is there a solution to this problem؟
any help please..