Forum

Thread tagged as: Question, Problem, Configuration

Support for extensionless URLs

In .htaccess I have it setup so that all php pages on my sites are only accessible without their .php extension. This works great, except for a problem with the perch editor.

When editing a region, the "View Page" link in the Smart Bar at the top of the page includes the .php extension, which results in a non-working URL. It seems that pages are referenced based on the filename instead of the REQUEST_URI actually used to access the file. I worked around this problem by editing the smartbar class and stripping off ".php" from the URLs, but this is not an elegant solution. Furthermore, the solution does not affect the draft "preview" feature, as that URL also includes the .php extension. Fixing that is a separate endeavor.

Rather than continuing to modify core files, I was hoping someone here could put me on a simpler path. Is there any way to simply have Perch index my pages by the URL used to access them? Or perhaps I can make one simple change to the core files rather than several. Any ideas?

Dominic Tocci

Dominic Tocci 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

We can't offer support if you edit core files. If you set the "URL for single items" setting in the region settings, you can customise the link.

Otherwise, this is something Perch Runway will give you.

Thanks, Drew. I would prefer not to edit core files.

Going forward, the "URL for single items" field seems to solve the problem without requiring the editing of any core files. Great! The only issue now is that it seems I must remember to manually set this field for every new region created. It would be great to setup a filter that could be used to set this field automatically from the page path.

For my existing Perch sites, I believe the only way to get things working now is to edit hundreds of regions one by one, and manually set this field. I suppose I'll need to find a way to automate this. Perhaps a script to modify the JSON in the regionOptions field of the content_regions table would do the trick.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Again, we wouldn't support that.

Understood. So perhaps just take it as a feature request. The ability to auto-set the "URL for single items" using a filter would be great. Thanks for your time.