Url Rewriting (Wordpress permalink)

Discussion in 'Third-party applications' started by redarko, Mar 21, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have a domain pointer (let's say www.domain.com) to my discountasp.net account that redirects in the abc folder.

    Code:
                    
    <rule name="Rewrite to domain" stopProcessing="false">
                        <match url="(.*)" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="^www.domain.com$" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="abc/{R:0}" />
                    </rule>
    

    I have then under the abc/blog subfolder a wordpress installation and I am trying to remove 'index.php' from my url sticking a rewriting rule in the webconfig that is in the blog root folder, following those instructions:
    http://learn.iis.net/page.aspx/466/enabling-pretty-permalinks-in-wordpress/
    or
    http://www.geekblogger.org/2010/03/how-to-set-pretty-permalinks-in.html

    So now the web.config in the blog folder looks like:

    Code:
    <?xml version="1.0"?>
    	<configuration>
        	 <system.webServer>
            <defaultDocument>
               	  <files>
                    	    <remove value="index.php" />
                    	    <add value="index.php" />
                </files>
            </defaultDocument>
            	<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/{R:0}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    I have already configured the permalink setting in WordPress to be /%postname%/. The problem is that this still doesn't seem to work and I still receive a 404 error when I try to access my blog content typing www.domain.com/blog/test while www.domain.com/blog/index.php/test is working fine.


    I followed the instruction in the iis forum, but I can't still have it working, obviously there is something to do specifically for discountasp.net accounts to make it work. Could anyone advice?
     
  2. mjp

    mjp

    That WordPress configuration setting probably generates an .htaccess file for redirects, which isn't going to do anything on a Windows server.

    Is your account on an IIS 7 server (check "Web Server Type" here)? The easiest thing to do would probably be to log in to IIS Manager and setup a rewrite rule there. It will write the proper lines into your web.config...
     
  3. Thank you for your reply. Yes I am on IIS7.


    As you could see in my previous post. I have already created the following rule (taken from an how to in the iis website), but it is not working in my DASP account.

    Code:
    <?xml version="1.0"?>
    	<configuration>
        	 <system.webServer>
            <defaultDocument>
               	  <files>
                    	    <remove value="index.php" />
                    	    <add value="index.php" />
                </files>
            </defaultDocument>
            	<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/{R:0}" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
     
  4. ...For me this is interesting in that I have no idea if a web.config will do anything for Wordpress.
    Does it?
     
  5. Hi,
    I'll ask some of my Twitter followers, some of them are .NET devs using Wordpress.
    All the best,
    Mark
     
  6. Great! Thanks
     
  7. ...Still haven't gotten any word back on this.
    I did notice however that in the IIS forums this is brought up at times.
    Try a post there and see what you get:
    http://forums.iis.net/1152.aspx
    All the best,
    Mark
     
  8. I actually just made it!


    That's the custom permalink setting I am using in wordpress: /%postname%/

    And this is the rule I am using in the web.config that is in the blog folder:
    Code:
                         <rule name="SEO Permalink" 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>
    Thank you for your support
     
  9. Awesome! ;-)
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page