How to remove index.php from url using web.config in iis server 8.0? - wordpress

I have installed wordpress in iis server version 8.0. i have added custom structure in wordpress permalinks. server is not supporting permalinks. so i created web.config to remove index.php from the url.i cant able remove index.php. In root website i have web.config file. i have created another config file to remove the index.php from the url in the sub folder. its not working. Is there any solution to remove it.
website url: http://www.cyz.com/blog/index.php/links
to
url: http://www.cyz.com/blog/links
code in blog folder:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="blog/index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="WPurls" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="blog/index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Related

IIS URL Rewrite to querystring parameter

I need to capture requests to folders that aren't file folders to be redirected to a default page with the requested path as the querystring.
For example, if the user requests
www.mysite.com/IT
I want it to redirect to
www.mysite.com/default.aspx?q=IT
However, if they request a page that is in a real sub-folder, that shouldn't be redirected. For example, requests to www.mysite.com/projects/new.aspx shouldn't try to do any re-directions as it's a physical folder and file in the site.
Use the IIS Rewrite module and the set it up in the web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirector" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{PATH_INFO}" pattern="/*" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/default.aspx?q={PATH_INFO}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
You could define a 404 error page that would redirect to your default page with the "q=" that you desire

WordPress permalinks rewrite on iis7

I spend a lot of time in looking for solution, so you are my last hope before giving up :)
On my localhost iis7 i set custom permalinks http://sitename/%sample-post%/ with rewrite mode installed.
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.php"/>
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="WordPress: http://tip4u03" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration>
Its work only in wwwroot directory. Outside of wwwroot directory, its return 404 template page. Same issue on my shared iis7 server (VPS)
I solved the issue !!!
The problem was't with site location, it was because the permalinks are in Hebrew language. I added the following condition to wp-config file
if (isset($_SERVER['UNENCODED_URL'])) {
$_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
}
according to this link: Wordpress Hebrew permalinks
Finally its work !

Adding code to web.config to hide my page extensions

I have this web.config file and i want to add a code to it that will hide the .asp of a page in my website called "users.asp" . please how do i do it
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
Obviously you need the URL rewrite module installed, and you need IIS7 or above, this won't work on IIS6
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^users/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="users.asp" />
</rule>
</rules>
</rewrite>
Recommended reading:
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

Web.Config issue with Wordpress

I have a site that uses Worpress on part of it. I am having trouble with the index page.
With index.php the site loads the most recent posts, which is the desired action with the incorrect url. Without index.php, which is the desired url, the page loads the 404 template.
I have the site working locally correctly. The only thing I can think of, is the web.config is incorrectly routing this request. Since this is an area I don't deal well with, I was hoping to get some help to see if that was the issue.
Here is the web.config contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 2-1" stopProcessing="true">
<match url="." ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
It sounds like you don't have index.php in the list of Default Documents. Add index.php to the list as shown below. You can also do this through the IIS settings for Default Document.
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.asp" />
<add value="Default.asp" />
<add value="Default.htm" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>

Web.Config causes 500 internal server error

This is my web.config file contents:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
I'm trying to use pretty permalinks of wordpress.
But this web.config files causes 500 Internal Server Error.
What is the problem?
The problem was from the server, they have not installed Microsoft URL Rewriting Module correctly...
The module has been installed correctly, and then problem solved.
The answer provided by Mahdi is correct. However, if you are unable to install the URL Rewrite module (which was the problem I had due to some signature verification problem), you can download an older version of the module from the link provided below. This ended up working for me.
Hope this helps.
https://forums.iis.net/t/1239468.aspx?URL+rewrite+installation+failing+due+to+signature+verification+failure

Resources