PrettyURLs - How do you configure the settings?

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
Post Reply
Dorian
Posts: 4
Joined: Tue Apr 11, 2023 7:04 am

PrettyURLs - How do you configure the settings?

Post by Dorian » Tue Apr 11, 2023 7:21 am

Brand new user. I'm testing the waters because I'd like to migrate my blog away from Wordpress and flat-file CMSs have always intrigued me. Anyway, I've searched the wiki and the forums and I'm stumped at how to get PrettyURLs to work. My URLS contain .php and question marks and otherwise don't look pretty which tells me something isn't configured.

Dorian
Posts: 4
Joined: Tue Apr 11, 2023 7:04 am

Re: PrettyURLs - How do you configure the settings?

Post by Dorian » Wed Apr 12, 2023 3:13 pm

A softaculous instance of of flatpress installed here (might be expired by the time someone visits) has URLs that look mostly identical to my installation. For example...

BLOG - softaculous.com/FlatPresssdgnspmxjy/?paged=1
ABOUT -softaculous.com/FlatPresssdgnspmxjy/static.php?page=about
CONTACT - softaculous.com/FlatPresssdgnspmxjy/contact.php

What specifically are the formatted URLs supposed to look like when this plugin is active?

User avatar
WineMan
Posts: 106
Joined: Tue Sep 01, 2020 5:03 pm

Re: PrettyURLs - How do you configure the settings?

Post by WineMan » Wed Apr 12, 2023 3:55 pm

I'm getting an internal Server error when I click on the link.

Dorian
Posts: 4
Joined: Tue Apr 11, 2023 7:04 am

Re: PrettyURLs - How do you configure the settings?

Post by Dorian » Wed Apr 12, 2023 4:07 pm

Looks like softaculous deletes their demo sites after about 30 minutes. If you want to install another demo and view the results, click here and to access the admin, the useraname/password is admin/password.

User avatar
fraenkiman
Posts: 210
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: PrettyURLs - How do you configure the settings?

Post by fraenkiman » Wed Apr 12, 2023 6:28 pm

Hello Dorian,

basically the PrettyURL plugin works quite well.

A blog entry can be reached as follows, depending on the settings:

Automatically

Code: Select all

https://frank-web.dedyn.io/index.php/2023/01/29/flatpress-13-andante-soll-veroffentlicht-werden/
Path Info

Code: Select all

https://frank-web.dedyn.io/index.php/2023/01/29/flatpress-13-andante-soll-veroffentlicht-werden/
HTTP Get

Code: Select all

https://frank-web.dedyn.io/?u=/2023/01/29/flatpress-13-andante-soll-veroffentlicht-werden/
Pretty

Code: Select all

https://frank-web.dedyn.io/2023/01/29/flatpress-13-andante-soll-veroffentlicht-werden/
For the plugin to work as expected, mod_rewrite must be installed on the web server.

Furthermore, the plugin should be allowed to create a new .htaccess file in the root directory. The content of this file then looks something like this:

Code: Select all

Options -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([a-zA-Z0-9_-]+)/$ ./static.php?page=$1 [L]
RewriteRule ^.+/comments/$ ./comments.php [L]

RewriteRule ^(.+)/$ blog.php [L]

</IfModule>
There is an issue with an enhancement suggestion on Github via the PrettyURL plugin. It may be possible to create a rewrite rule in the .htaccess file.

I'll take a closer look in the days.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Dorian
Posts: 4
Joined: Tue Apr 11, 2023 7:04 am

Re: PrettyURLs - How do you configure the settings?

Post by Dorian » Thu Apr 13, 2023 4:31 am

Would it be complicated to make the URLs more closely match wordpress' /%postname%/ setting? In this case they would look similar to this...

https://frank-web.dedyn.io/flatpress-13-andante-soll-veroffentlicht-werden/

Rather than including the date portion...

https://frank-web.dedyn.io/2023/01/29/flatpress-13-andante-soll-veroffentlicht-werden/

User avatar
fraenkiman
Posts: 210
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: PrettyURLs - How do you configure the settings?

Post by fraenkiman » Sat Apr 15, 2023 11:04 pm

Hello Dorin,

the date in the URL belongs to the fixed permalink structure of FlatPress.

The process of removing the date from your permalinks is extremely common but can be detrimental if done incorrectly. It can negatively impact both SEO and Google search rankings for your FlatPress website.

I have successfully tested a redirect rule for the .htaccess file.

Code: Select all

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ https://your-website.ltd/$4
For the rule to work, you need to set the mode to "Pretty" in the PrettyURL plugin.

However, before this rule, you need to rewrite it so that /YYYY/MM/DD is removed from the URL.
With the rewrite I don't get a consistent result.

I have created a suggestion for improvement.

With best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests