#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0

    Web.config and url rewrite - Error 500


    I am trying to rewrite my URLs to be SEO friendly. I'm using IIS7 and web.config xml file to specify the rules for a specific folder.

    The XML is as follows:

    Code:
    <configuration>
    	<system.webServer>
    		<rewrite>
    			<rules>
    				 <rule name="Phioro Main Rewrite Rule">
                        <match url="^(.*)$" />
                        <conditions>
                            <add input="{URL}" pattern="^([^/]+)/([^/]+)/?$" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?c={R:1}&p={R:2}" appendQueryString="true" />
    					<serverVariables> 
                            <set name="HTTP_ACCEPT_ENCODING" value="" /> 
                        </serverVariables> 
                    </rule>
    			</rules>
    		</rewrite>
    	</system.webServer>
    </configuration>
    For some reason, whenever this code is saved and I load the page, I get an Error 500 Internal Server Error with no explanation for the error. I'm unable to find any error logs either.

    For the record, URL rewrite is working with WordPress on the same server. It also works with other copy-paste scripts from the internet, so I know it must be a problem with my XML file.

    Ultimately I have a url: example.com?c=category&p=page and want to rewrite it to example.com/category/page

    Any advice would be greatly appreciated! I've spent hours on this!!
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,430
    Rep Power
    4539
    If you're using IE try turning off the "show friendly http errors" setting, perhaps you'll get a more complete error message.

    Did you look in the server windows event logs as well as the http logs?
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    Originally Posted by Doug G
    If you're using IE try turning off the "show friendly http errors" setting, perhaps you'll get a more complete error message.

    Did you look in the server windows event logs as well as the http logs?
    Hi Doug,

    Thanks for helping me.

    I'm using Google Chrome.

    Where do I find the windows event logs?
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,430
    Rep Power
    4539
    I usually get to the event logs by right-click on My Computer on the desktop then picking Manage.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    I managed to locate the system logs but nothing out of the ordinary and nothing connected to the server side of things.

    Any other suggestions?

    Do you have experience with web.config syntax? Perhaps there's something wrong with the XML?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2009
    Location
    Nebraska, USA
    Posts
    867
    Rep Power
    275
    Are you certain that you have the URL Rewrite module for IIS installed?

    there is a v2.0 available HERE along with some other links which may help you.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    Yes this works for other copy-paste web.config files, and it also works for Wordpress running on the server.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    Just tried to re-install v2.0 but it says it's already installed and won't let me re-install.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    More info:

    The OS is Windows Server 2008 R2
    IIS 7
    Running PHP 5

    Had previous issues with FastCache when I tried to get URL Rewrite working from IIS itself.
  18. #10
  19. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,430
    Rep Power
    4539
    Do you have experience with web.config syntax? Perhaps there's something wrong with the XML?
    Sorry, I pretty much stopped using IIS at v5, I've been doing all web server work since on LAMP
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    Do you have any suggestions on where I might find the solution to this problem? Even outside this site? (sorry)

    It's quite a major issue and is stopping me from moving forward with development.
  22. #12
  23. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,430
    Rep Power
    4539
    Microsoft sponsors support newsgroups. Also microsoft technet has very good documentation.

    [http://technet.microsoft.com/en-us/l...8WS.10%29.aspx

    http://support.microsoft.com/kb/171058

    iisfaq.com used to be a good site, but I just tried going there and didn't connect.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  24. #13
  25. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0
    Thanks very much Doug!

IMN logo majestic logo threadwatch logo seochat tools logo