Title: Trailing Slash Problem
Last modified: August 31, 2016

---

# Trailing Slash Problem

 *  [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/)
 * Hello!
 * I’m running a WordPress install in a subfolder on one of my client’s sites. The
   server is IIS I’m pretty sure (it uses a web.config file instead of an .htaccess)
   and I’m having issues getting the site home page (set to show the latest posts)
   to show up without the trailing slash at the end of the url. The site works fine
   with the / at the end of the url, but without it, the site redirects back to 
   the main site on the domain (the non-Wordpress site that’s not in the subfolder).
 * Anyway, I’m pretty sure this issue is IIS related, but have spent time researching
   and testing and what I’ve found isn’t working. Any help would be appreciated,
   thanks!

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960021)
 * Hiya,
 * This sounds like a simple pattern issue in your `web.config` file, if you are
   still having this issue, could you perhaps share the content of this file with
   us?
 *  Thread Starter [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960023)
 * Sure! Below is the code that’s in the /blog/ subfolder with the WordPress files.
   Do you need the code from the main folder web.config as well?
 *     ```
       <?xml version="1.0" encoding="UTF-8"?>
       <configuration>
         <system.webServer>
          <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>
       </configuration>
       ```
   
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960026)
 * Hi,
 * Nah this should be sufficient, it’s peculiar that it isn’t working as this one
   seems like it -should- catch everything, but we can try a slight edit that might
   fix it.
 * Change `<match url=".*" />` to instead read `<match url=".*\/?" />`
 * It’s a bit of a shot in the dark as it shouldn’t matter, but I also know that
   IIS some times does strange things, so this is a great first step in troubleshooting
   it at least 🙂
 *  Thread Starter [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960029)
 * Unfortunately, that didn’t seem to fix the issue. I still wonder if something
   in the main site’s web.config is causing this? I’ve posted a snippet from the
   main web.config below (didn’t post the whole file for security reasons). Thanks
   again for your assistance!!
 *     ```
       <system.webServer> 
           <rewrite>
           <rules>
               <rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
                   <match url="*" />
                   <conditions>
                       <add input="{HTTP_HOST}" pattern="example.com" />
                   </conditions>
                   <action type="Redirect" url="http://www.example.com/{R:0}" />
         </rule>
       </rules>
       </rewrite>
       </system.webServer>
       ```
   
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960036)
 * That’s just a www redirector, I don’t see it as being the source of this.
 * Is the site in the root location also a WP site, or is this something completely
   different ?
 *  Thread Starter [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960037)
 * Ok. No, the site in the root location is a custom php site (non-WP).
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960039)
 * Hmmm…
 * On your WordPress site, could you show how your permalinks are configured (the
   most efficient approach here is to take a screenshot of the Settings > Permalinks
   screen) ?
 *  Thread Starter [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960040)
 * [Link to Screenshot](https://drive.google.com/file/d/0BwGW25txgw2vWFl5R2VseWtycmc/view?usp=sharing)
 * Above is a link to a screenshot of the Permalinks page. Also, the plugins I have
   active on the site are:
    - Attachment Pages Redirect
    - Disable Comments
    - Easy Author Image
    - Easy Updates Manager
    - Google XML Sitemaps
    - Quick Page/Post Redirect Plugin
    - Sucuri
    - Wordfence
    - WP Sitemap Page
    - Yoast SEO
 * Thanks again for all your assistance!!
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960045)
 * Hmm,
 * The permalinks etc seem fine, but I am wondering if one of those redirect plugins
   might be the cause of this.
 * Could you try it without any plugins active for a moment and see what happens(
   You may want to disable any plugins, then go to Settings > Permalinks, hit save
   twice and then see if it works)
 *  Thread Starter [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960046)
 * I got it to work!!!!! This [link](http://stackoverflow.com/questions/8420371/why-does-iis-7-5-adds-a-trailing-slash-on-folders-can-we-disable-courtesy-redir)
   and this [link](http://stackoverflow.com/questions/22383619/removing-the-trailing-slash-from-a-nested-applications-virtual-directory-root-i/25817317#25817317)
   got me on the right track and so the final web.config code that works is below
   for reference. I really appreciate your patience and assistance. All the best!
 *     ```
       <?xml version="1.0" encoding="UTF-8"?>
       <configuration>
         <system.webServer>
   
       	<defaultDocument enabled="false" />
       	<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>
   
       			<rule name="No slash root" enabled="true" stopProcessing="true">
                   <match url="^$" />
                   <action type="Rewrite" url="index.php" />
               </rule>
       			</rules>
           </rewrite>
         </system.webServer>
       </configuration>
       ```
   
 *  Thread Starter [sweettea2](https://wordpress.org/support/users/sweettea2/)
 * (@sweettea2)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960047)
 * Scratch that…I thought I got it working, but then tried logging into the admin
   area of the WP site and got a 404 error. So, it works on the front-end, but messes
   up the admin area and won’t let me see the dashboard if I go to example.com/blog/
   wp-admin. It takes me to the login page if I go to example.com/blog/wp-login.
   php directly, but if I log in, it goes to a 404.
 * Thoughts…??
 *  Moderator [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * (@clorith)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960048)
 * Could you add an ignore part t oyour rule for the wp-admin directory and see 
   if that helps ?

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Trailing Slash Problem’ is closed to new replies.

## Tags

 * [iis](https://wordpress.org/support/topic-tag/iis/)
 * [trailing slash](https://wordpress.org/support/topic-tag/trailing-slash/)
 * [url problem](https://wordpress.org/support/topic-tag/url-problem/)
 * [web.config](https://wordpress.org/support/topic-tag/web-config/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 2 participants
 * Last reply from: [Marius L. J.](https://wordpress.org/support/users/clorith/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/trailing-slash-problem-2/#post-6960048)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
