Mod Rewrite Friendly URLs in IIS7

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Scott927
    New Member
    • Dec 2011
    • 22

    [Forum] Mod Rewrite Friendly URLs in IIS7

    I have vB 4.1.9 installed on a Windows 2008 Server running IIS7. URL Rewrite is installed. My forum is located at http://www.domain.com/forums. When I enable Mod Rewrite Friendly Urls, the link that gets generated for one of my forums looks like this:



    I'm running into two problems:

    1) There's a duplicate forums subdirectory generated in the URL.
    2) Even if I delete that duplicate directory manually from the URL, I still get a 404.

    Are there any detailed instructions or can someone provide some for setting up URL Rewriting with IIS7? I know I probably need some rewrite rules in my web.config, but I'm not sure what rules to add.
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 74161

    #2
    You have vBulletin installed in the /forums/ directory. The second forums is there as a script identifier for the URL Rewrite. It tells the system to rewrite to forumdisplay.php. There is no way around this without custom coding.

    To make your rewrite URLs work, you also need to upload the web.config file located in the do_not_upload/rewrite/IIS7 directory of your download package. The web.config file tells IIS and the Rewrite URL module how to handle the URLS and send them to the proper location. You should place this in your /forums/ directory.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    • Scott927
      New Member
      • Dec 2011
      • 22

      #3
      Thanks, got it working. Is there a way to change the second "forums" so that I can at least make it look better or is it deeply integrated into the PHP? Maybe I could change it to:

      http://www.domain.com/forums/forum/2-blah-blah (the second forum is singular). I know how to modify the rewrite rule for that, but is it easy to change the generated directory name?

      Comment

      • Wayne Luke
        vBulletin Technical Support Lead
        • Aug 2000
        • 74161

        #4
        You would have to look at the class_friendly_url.php file. We can't give support for directly modifying the code though.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment

        • Scott927
          New Member
          • Dec 2011
          • 22

          #5
          Thanks, that was all I needed. For anyone else who might come across this thread, in the /includes/class_friendly_url.php file search for:

          protected $rewrite_segment = 'forums';

          and change "forums" to whatever you want. Don't forget to modify the web.config rewrite rule for forums, you'll need to change it there as well.

          <rule name="vB Forums" enabled="true" stopProcessing="true">
          <match url="^forums/.*" ignoreCase="true" />
          <conditions logicalGrouping="MatchAll">
          <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="true" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="true" negate="true" />
          </conditions>
          <action type="Rewrite" url="forumdisplay.php" appendQueryString="true" />
          </rule>

          Comment

          • Final Kaoss
            Senior Member
            • Nov 2006
            • 581

            #6
            Yeah, we know how it works. Glad you could figure it out.

            Comment

            • NashChristian
              Senior Member
              • May 2008
              • 187
              • 4.0.0

              #7
              Originally posted by Scott927
              Thanks, that was all I needed. For anyone else who might come across this thread, in the /includes/class_friendly_url.php file search for:

              protected $rewrite_segment = 'forums';

              and change "forums" to whatever you want. Don't forget to modify the web.config rewrite rule for forums, you'll need to change it there as well.
              THANKS for following up with us! I've been searching for this solution for 20 minutes, I'm glad to have found your post!

              Thanks again!
              Jeff

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...