Load Delay and Routing Issue

Hi SiteCake Team!

Let me start by saying, you have a great product here! :relaxed:

However, I am encountering a small issue. I have set up my .htaccess to drop .php when you go to url , like example.com/about NOT example.com/about.php

Therefore, when I go to edit each page, sitecake editor throws an error because the routing drops the .php like this: http://luck_dev/sitecake.php?scpage=new-business

I end up having to add .php to it. So before I have to hack the code, what is your solution since this is your code base?

Hi,

maybe you could try add some redirection rules through .htaccess for /sitecake.php?scpage=your-page to be redirected to /sitecake.php?scpage=your-page.php. Or try to rewrite query string in your .htaccess (https://wiki.apache.org/httpd/RewriteQueryString).

If you manage to solve this, can you please put your solution here so others can also see it.

Thanks

@predragleka Thank you so much for your prompt reply. I did indeed figure out a simple and quick solution.

Go to file: sitecake/2.3.6/src/Sitecake/draft.php and change the following line: 155 to…_
$node->setAttribute('href', $entryPointPath . '?scpage=' . ltrim($href, './').".php");

However because I added .php, when you click a link to go back to a home page, and if the url is ‘/’ then you must explicitly add index to your .htaccess like:
RewriteRule ^index$ index.php [L,NC]

Also keep in mind if your .htaccess contains [NC] it means no caps, so if your file is camel-case the browser will look for no caps, and wont find it. So best practice here, and in general is keep your .htaccess routes that will contain a page that will be edited, all lower cased.

Works like a charm.

Hello, how to solve this problem in version 2.4.10?

Hi, try same thing but code that is updating URL is located in sitecake/2.4.10/src/Sitecake/Content/PageRenderAwareTrait.php near end of a file. Keep in mind that you will have to do similar thing after each upgrade.