User Tools

Site Tools


res:plugins:prettyurls

PrettyURLs

Description

PrettyURL plugin turns standard URLs into SEO friendly URLs.

Handling

For this to work as expected for entries, the server configuration must be adjusted. If the .htaccess file does not yet exist in the main FlatPress directory, the plugin helps you to create a suitable file. Open the main panel Plugins in the administration area. Then open the subpanel PrettyURLs. In the editor window you can see the recommended content for the .htaccess file.

				
# Thanks again WP :)

Options -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /flatpress-instance/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /flatpress-instance/index.php [L]
</IfModule>				

You only need to save this file.

Done.

If this does not work, have a look at the Troubleshooting.

Advanced

To make files with the extension .php (e.G. contact.php, search.php) also friendly accessible, paste the following code into the editor instead of the above code:

Options -Indexes
Options +MultiViews
Options +FollowSymLinks

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /flatpress-instance/

# Removing .php Extension and adding a trailing slash at the end
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^/]+)/$ $1.php
  RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
  RewriteRule (.*)$ /$1/ [R=301,L]

# Remove the fp-content directory
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule ^images/(.*) /flatpress-instance/fp-content/images/$1 [L]
  RewriteRule ^attachs/(.*) /flatpress-instance/fp-content/attachs/$1 [L]

# Redirect all other requests to index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^.*$ /flatpress-instance/index.php [L,QSA]
</IfModule>

Important note

In order for the PrettyURLs plugin to write or modify the .htaccess file, it is necessary that the directory and file permissions for the .htaccess file are set (chmod 0775).

Please note that on apache+windows prettyurls will not work, because there is NO mod_rewrite support!

res/plugins/prettyurls.txt · Last modified: 2023/05/07 23:20 by fraenkiman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki