CSS path after IIS url rewrite - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: CSS path after IIS url rewrite (/showthread.php?tid=29618) |
CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]vertmonkee[/eluser] I followed the instructions on this page http://codeigniter.com/wiki/Miscellaneous/ and everything works fine for removing index.php from urls. This has now caused my CSS file to not be found. The file is in a folder structure like this from the root assets/css/stylesheet.css I've tried the following http://mysite.com/assets/css/stylesheet.css /assets/css/stylesheet.css assets/css/stylesheet.css But none of those options work. My web config file looks like this Code: <?xml version="1.0" encoding="UTF-8"?> Can anyone suggest how to fix this? Thanks for any help CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]danmontgomery[/eluser] Try adding the assets directory to the rule that doesn't get rewritten: Code: <match url="(index.php|robots.txt|images|test.php|assets)" /> CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]vertmonkee[/eluser] [quote author="noctrum" date="1271371185"]Try adding the assets directory to the rule that doesn't get rewritten: Code: <match url="(index.php|robots.txt|images|test.php|assets)" /> Thanks for your quick reply. I added assets to the rule but it's still not working, even though when I test the pattern in IIS it says it is ok. Any other ideas? Thanks CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]danmontgomery[/eluser] When you go to http://mysite.com/assets/css/stylesheet.css in your browser, does it load? Do you get an IIS 404? CI 404? CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]vertmonkee[/eluser] I get an IIS 404 CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]danmontgomery[/eluser] Interesting... I'm not familiar enough with IIS to be any more help, I don't think CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]vertmonkee[/eluser] No problems, thanks for your help so far. When I read your first post I was convinced that would work perfect first time. Thanks again CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]danmontgomery[/eluser] Might the problem be that you don't have an action for the first rule? Something like: Code: <rule name="codeigniterRuleOne"> (again, not real familiar with IIS, syntax may be wrong) CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]vertmonkee[/eluser] Thanks for coming up with another good suggestion, unfortunately that one produces a 500 error. I created the rules in the IIS GUI so I expect the actual rules to have been written to the config file correctly. CSS path after IIS url rewrite - El Forum - 04-15-2010 [eluser]vertmonkee[/eluser] Right, I've got it sorted. The rules were in the correct order I needed to tell it to stop processing rules after it matched the first one. I did this in the IIS GUI, it's just a checkbox. And this is the resultant config file <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="codeigniterRuleOne" stopProcessing="true"> <match url="index.php|robots.txt|images|test.php|assets" /> <conditions logicalGrouping="MatchAll" /> </rule> <rule name="codeigniterRuleTwo"> <match url=".*" /> <conditions logicalGrouping="MatchAll" /> <action type="Rewrite" url="index.php/{r:0}" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer> </configuration> Thanks to noctrum for his very good suggestions which helped me whittle down the options to find the solution. |