Set the root path without project name

How do I fix the path that chrome sees on my projects? For example the url in the browser looks like:

http://localhost:63342/myproject/index.html

I want it to look like: 

http://localhost:63342/index.html

I've tried changing the Content Resource Root but it doesn't make a difference. It's set to /home/"username"/myproject,

If I can correct this my links to stylesheets and images will work correctly and I'll actually be able to use WebStorm. 

I'm using a Ubuntu 16.04 64 bit workstation, and Webstorm 2017.3.2

5
9 comments


The built-in web server serves files from http://localhost:63342/<project name> (this is done to allow serving several projects at once).
There is no way to set it up to use http://localhost:63342/ URL. But you can configure it to use URLs like http://<project_name>:<port> where the 'project name' is a name specified in hosts file, like 127.0.0.1 project_name. See https://youtrack.jetbrains.com/issue/WEB-8988#comment=27-577559.

But, rather than changing hosts, etc., I'd suggest using different server (Apache, etc.) to host your application if you like it being served from the root.

1
Avatar
Permanently deleted user

Thanks Elena,

Out of curiosity, why do you recommend using a different server over changing the hosts file?

best,

-james

0

The built-in webserver is a simple solution for development - it has some limitations as compared to full-functional web server, and you will still need a different server for production. Also, we have some reports regarding performance degradation when debugging applications with modified hosts.

1

The problem with the way JetBrains has implemented this across their tools is that in order to use the convenient debugger+web server for a project (e.g. I use WebStorm), it injects the project name into the URL path instead of just using a different port. This affects how all the project assets are addressed since the project name will not be in the hosted URL. This is a bad design choice by JetBrains and causes a cumbersome work around on our part. 

The best solution is to simply not introduce the project name into the path. Use ports. The overwhelming majority of us are not going to be juggling simultaneous projects anyway so that use case is not prevalent. But not being able to use constant asset paths, for example, in css files because of this, that is a problem.

8

I know this is an older topic but I stumbled over that problem just a few minutes ago, because I want to include custom web fonts and the URL just breaks everything in the preview.

That currently renders the builtin server somehow useless for me and I don't think custom webfonts are an edge case.

I'd also like to see different ports per project instead.

0

Same issue. I just paid for an Ultimate subscription, thinking I it would be more helpful that VS Code, but it turns out to be more harmful to my productivity because of bad design like this.

0

same issue here! It's annoying that I have to put different paths for testing on localhost and for production :(

0

That is a big issue for me.

I am developing now on vscode, and I miss webstorm.

Fix this asap please

0

Yeah I'm completely green when it comes to coding and I'm trying my hardest to learn this nonsense because the world demands that I learn this nonsense see the crappy part about all this really is is that you guys have forced all this crap upon us I didn't ask for this at all I didn't ask for the world to turn into a bunch of robots and the brink of humanity be up for grabs I don't answer any of this s*** it's not fair honestly I was completely content living my crappy life without getting crappy because I got to start writing numbers and s*** now I'm being stopped by an index.html file that no matter how organized I make it no matter how pretty I make the the string it's just not going to let me go and I can't I cannot abide by an error just want to learn this s*** I want to be done right so thanks everybody in this room for contributing to this I appreciate it I'm so happy that you guys can dictate the fate of the planet and force people like me into learning this crap that we don't want to learn so since there's no answers to this question anywhere in any of these feeds and since it's the same problem it's been there since 2012 I'm guessing y'all are not going to fix it so I'm going to go ahead and Mosey about my way and you know hopefully I don't get killed by an AI in 6 months because you morons couldn't find something else better to do appreciate it.

-3

Please sign in to leave a comment.