Yii Url rewriting under IIS, iisyiiurl rewriting_PHP tutorial
Yii Url rewriting, iisyiiurl rewriting under IIS
Options +FollowSymLinks IndexIgnore */* RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php
The automatically generated web.config is as follows
<span><?</span><span>xml version="1.0" encoding="UTF-8"</span><span>?></span> <span><</span><span>configuration</span><span>></span> <span><</span><span>system.webServer</span><span>></span> <span><</span><span>directoryBrowse </span><span>enabled</span><span>="false"</span> <span>/></span> <span><</span><span>rewrite</span><span>></span> <span><</span><span>rules</span><span>></span> <span><</span><span>rule </span><span>name</span><span>="已导入的规则 1"</span><span>></span> <span><</span><span>match </span><span>url</span><span>="."</span><span> ignoreCase</span><span>="false"</span> <span>/></span> <span><</span><span>conditions </span><span>logicalGrouping</span><span>="MatchAll"</span><span>></span> <span><</span><span>add </span><span>input</span><span>="{REQUEST_FILENAME}"</span><span> matchType</span><span>="IsFile"</span><span> ignoreCase</span><span>="false"</span><span> negate</span><span>="true"</span> <span>/></span> <span><</span><span>add </span><span>input</span><span>="{REQUEST_FILENAME}"</span><span> matchType</span><span>="IsDirectory"</span><span> ignoreCase</span><span>="false"</span><span> negate</span><span>="true"</span> <span>/></span> <span></</span><span>conditions</span><span>></span> <span><</span><span>action </span><span>type</span><span>="Rewrite"</span><span> url</span><span>="index.php"</span> <span>/></span> <span></</span><span>rule</span><span>></span> <span></</span><span>rules</span><span>></span> <span></</span><span>rewrite</span><span>></span> <span></</span><span>system.webServer</span><span>></span> <span></</span><span>configuration</span><span>></span>
5. Modify config.php
'urlManager' => <span>array</span><span>( </span>'urlFormat' => 'path', <span>//</span><span>URL 格式。共支持两种格式: 'path' 格式( 如:/path/to/EntryScript.php/name1/value1/name2/value2... ) 和'get' 格式( 如:/path/to/EntryScript.php?name1=value1&name2=value2...)。当使用'path'格式时,需要设置如下的规则:</span> 'showScriptName'=><span>false</span>, <span>//</span><span> 'urlSuffix'=>'.html',</span> 'rules' => <span>array</span>(<span>//</span><span>URL 规则。语法:<参数名:正则表达式></span> '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>',<span> )</span>,<span> )</span>,
It seems that "URL_MODE"=>2 is added to the conf file in the conf directory. I don't know if this is the case
You can only manually match the old address rules and then jump to the new address.
Example:
if ( preg_match( '/cate\_detail/[^\.]+/i' ,$_SERVICE['REQUEST_URI'] ) )
{
$this->redirect($this->createUrl('category/detail', array('cate'=>'Literature')) , true, 301);
}
My URL structure originally was /cate_detail/literature.html, but later it was changed to /cate/literature.html. Just add the above code to the init() method of Controller.php, the parent class of all controllers

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The reason for the error is NameResolutionError(self.host,self,e)frome, which is an exception type in the urllib3 library. The reason for this error is that DNS resolution failed, that is, the host name or IP address attempted to be resolved cannot be found. This may be caused by the entered URL address being incorrect or the DNS server being temporarily unavailable. How to solve this error There may be several ways to solve this error: Check whether the entered URL address is correct and make sure it is accessible Make sure the DNS server is available, you can try using the "ping" command on the command line to test whether the DNS server is available Try accessing the website using the IP address instead of the hostname if behind a proxy

To open an application pool in IIS: 1. Open IIS Manager; 2. Navigate to the "Application Pools" node; 3. Right-click the target application pool and select "Manage"; 4. Click "Advanced Settings" Tab; 5. Application pool configuration can be viewed and modified here.

Differences: 1. Different definitions, url is a uniform resource locator, and html is a hypertext markup language; 2. There can be many urls in an html, but only one html page can exist in a url; 3. html refers to is a web page, and url refers to the website address.

Converting an HTML file to a URL requires a web server, which involves the following steps: Obtain a web server. Set up a web server. Upload HTML file. Create a domain name. Route the request.

Yes, it is possible to delete IIS log files. Removal methods include selecting the website or application pool through IIS Manager and deleting the log file in the Log Files tab. Use a command prompt to go to the log file storage directory (usually %SystemRoot%\System32\LogFiles\W3SVC1) and use the del command to delete the log file. Use third-party tools such as Log Parser to automatically delete log files.

Solutions to iis failure to start: 1. Check the integrity of the system files; 2. Check the port occupancy; 3. Start related services; 4. Reinstall IIS; 5. Reset the Windows system; 6. Check the metabase file; 7. Check file permissions; 8. Update the operating system and applications; 9. Avoid installing too many unnecessary software; 10. Back up important data regularly. Detailed introduction: 1. Check the integrity of system files, run system file checking tools, check the integrity of system files, etc.

Solution: 1. Check whether the IIS service has been installed; 2. Check dependent services; 3. Check port conflicts; 4. Check configuration files and permissions; 5. Re-register IIS related components; 6. Check log files.

In Go, method overriding allows methods in a base class to be redefined in a derived class while keeping the same method signature: use the override keyword. The overridden method must have the same signature as the base method. The receiver type of the overridden method must be a subtype of the base type.
