doc:plugins:prettyurls
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| doc:plugins:prettyurls [2020/04/15 19:51] โ removed arvid | doc:plugins:prettyurls [2024/04/01 14:11] (current) โ created arvid | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== PrettyURLs ===== | ||
| + | ==== Description ==== | ||
| + | PrettyURL plugin turns standard URLs into SEO friendly URLs. | ||
| + | |||
| + | |||
| + | ==== Handling ==== | ||
| + | <WRAP right round tip 350px> | ||
| + | **Hint:**\\ Only web servers that are NCSA compatible, such as Apache, are familiar with the concept of .htaccess files. | ||
| + | </ | ||
| + | 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. | ||
| + | < | ||
| + | AddType application/ | ||
| + | Options -Indexes | ||
| + | |||
| + | < | ||
| + | RewriteEngine On | ||
| + | RewriteBase / | ||
| + | |||
| + | RewriteRule ^\.htaccess$ - [F] | ||
| + | |||
| + | RewriteCond %{REQUEST_FILENAME} !-f | ||
| + | RewriteCond %{REQUEST_FILENAME} !-d | ||
| + | RewriteRule . / | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | You only need to save this file. | ||
| + | |||
| + | Done. | ||
| + | |||
| + | If this does not work, have a look at the [[en: | ||
| + | |||
| + | ==== Advanced ==== | ||
| + | |||
| + | To make files with the extension .php (e.G. contact.php, | ||
| + | < | ||
| + | Options -Indexes | ||
| + | Options +MultiViews | ||
| + | Options +FollowSymLinks | ||
| + | AddType application/ | ||
| + | |||
| + | < | ||
| + | RewriteEngine On | ||
| + | | ||
| + | # Protects the .htacces file from external access, status code 403 " | ||
| + | RewriteRule ^\.htaccess$ - [F] | ||
| + | |||
| + | RewriteBase / | ||
| + | |||
| + | # Removing .php Extension and adding a trailing slash at the end | ||
| + | RewriteCond %{REQUEST_FILENAME} !-f | ||
| + | RewriteRule ^([^/]+)/$ $1.php | ||
| + | RewriteRule ^([^/ | ||
| + | RewriteCond %{REQUEST_FILENAME} !-f | ||
| + | RewriteCond %{REQUEST_FILENAME} !-d | ||
| + | RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1, | ||
| + | RewriteRule (.*)$ /$1/ [R=301,L] | ||
| + | |||
| + | # Remove the fp-content directory | ||
| + | RewriteCond %{REQUEST_FILENAME} !-f | ||
| + | RewriteCond %{REQUEST_FILENAME} !-d | ||
| + | RewriteCond %{REQUEST_FILENAME} !-l | ||
| + | RewriteRule ^images/ | ||
| + | RewriteRule ^attachs/ | ||
| + | |||
| + | # Redirect all other requests to index.php | ||
| + | RewriteCond %{REQUEST_FILENAME} !-f | ||
| + | RewriteCond %{REQUEST_FILENAME} !-d | ||
| + | RewriteRule ^.*$ / | ||
| + | | ||
| + | # Forwarding from http to https without consideration of the subdomain (www.) | ||
| + | RewriteCond %{SERVER_PORT} !^443$ | ||
| + | RewriteRule (.*) https:// | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== 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 0776). | ||
| + | |||
| + | Please note that on apache+windows prettyurls will not work, because there is NO mod_rewrite support! | ||
| + | |||
| + | ==== Nginx ==== | ||
| + | <WRAP right round tip 350px> | ||
| + | **Hint:**\\ [[https:// | ||
| + | </ | ||
| + | When using the Nginx server software, a few settings must be added manually with administrative access to the nginx.conf file. These can be found by default in the directories ''/ | ||
| + | |||
| + | First activate one of the two modes in the PrettyURLs configuration: | ||
| + | |||
| + | **(*) HTTP Get** - Example: /? | ||
| + | |||
| + | or | ||
| + | |||
| + | **(*) Pretty** - Example: / | ||
| + | |||
| + | Then add the following code to the nginx.conf file: | ||
| + | |||
| + | <code apache> | ||
| + | # see https:// | ||
| + | location / | ||
| + | if (!-e $request_filename) { | ||
| + | rewrite ^/(.+)$ / | ||
| + | break; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | โ ๏ธ It has not yet been confirmed that this works 100% on a live system. | ||
doc/plugins/prettyurls.1586973117.txt.gz ยท Last modified: by arvid
