Skip to content

URLs mailformed on Windows IIS

robiso edited this page Aug 23, 2017 · 6 revisions

Solution 1

Ensure you have configured your web.config for clean URLs: https://github.com/robiso/wondercms/wiki/IIS-server-config

Solution 2

  • posted by @vemman

On windows machines the URLs are malformed Instead of http://localhost/works/wondercms/loginURL I get http://localhostd/Works/wondercms/loginURL

I believe even if my work was inside apache's htdocs, I will still see the drive letter

Windows Setup Apache 2.4, PHP7 > in C drive My works are under D:\works\work_sub_folder

My Solution

I replaced INC_ROOT in function url with this dirname($_SERVER['SCRIPT_NAME'])

SOLUTION 2: Replace your function url with the bottom one

public static function url($location = null) { return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']) ) )."/{$location}"; }

Clone this wiki locally