Subfolder and text editor links


#1

cakephp 3.x
In development mode, I install cakephp in :
https://www.mywebsite/dev/client_name/

Writing links with the html helper works fine.
But, links written in a text editor (tinymce for me) do not work.
Example : /articles/view/xx do not lead to https://www.mywebsite/dev/client_name/articles/view/xx but to https://www.mywebsite/articles/view/xx

Is there a simple way to fix this issue ?


#2

Yes, this seems like normal behaviour.

/articles/view/xx tells the browser: from the root of the site (https://www.mywebsite) go to /articles/view/xx.
If you want it from the place you are, you can use absolute paths (https://www.mywebsite/dev/client_name/articles/view/xx) or relative paths (dev/client_name/articles/view/xx).


#3

Well there must be a solution but it is not an important issue.
Everything works fine in production.

Thank you for answering.


#4

You’re presumably not using urls with /dev/client_name in them on production.


#5

Do you mean in :
‘App’ => [‘base’]


#6

I mean, if you give a URL of /articles/view/xx, that will work on a production site where /articles really is at the webroot of the site, but it won’t work on a dev site where /articles doesn’t exist because the whole site is under /dev/client_name. This is how the internet works, there is no getting around it. What you probably need to do is instead set up a separate subdomain for each client, so instead of http://yourdomain.com/dev/client_name, their site is under http://client_name.yourdomain.com, for example.


#7

Thank you again.
But, I do not agree on everything or this would mean that you can’t install cake in a subfolder.
I think the solution comes from the .htaccess files.
I will try for a next client.


#8

You can install Cake wherever you want to. But if you’re using URLs that start with a /, they need to match whatever setup you’ve got for your Cake application. If the app is under /dev/client, then /articles/view/xx is no more a valid URL than /humpty/dumpty is. The URL you need to use, based on this setup of your Cake app, is /dev/client/articles/view/xx.

It is possible to set up .htaccess to make this work, but it would be the .htaccess under the main webroot, not under /dev/client, and it didn’t sound like that’s the situation you’re faced with; if you’ve got that kind of flexibility in the main webroot, then why not just put the app there?


#9

Thank you for taking time to explain.