|
| 1 | +# For full documentation and other suggested options, please see |
| 2 | +# http://rtfm.modx.com/evolution/1.0/administration/friendly-url-solutions |
| 3 | +# including for unexpected logouts in multi-server/cloud environments |
| 4 | +# and especially for the first three commented out rules |
| 5 | + |
| 6 | +#php_flag register_globals Off |
| 7 | +AddDefaultCharset utf-8 |
| 8 | +#php_value date.timezone Europe/Moscow |
| 9 | + |
| 10 | +#Options +FollowSymlinks |
| 11 | +RewriteEngine On |
| 12 | +RewriteBase / |
| 13 | + |
| 14 | +# Fix Apache internal dummy connections from breaking [(site_url)] cache |
| 15 | +RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC] |
| 16 | +RewriteRule .* - [F,L] |
| 17 | + |
| 18 | +#Remove ///// in url |
| 19 | +#RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$ |
| 20 | +#RewriteRule . %1/%2 [R=301,L] |
| 21 | + |
| 22 | +#redirect http to https |
| 23 | +#RewriteCond %{HTTP:SSL} !=1 [NC] |
| 24 | +#RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [L,R=301] |
| 25 | +#or |
| 26 | +#RewriteCond %{HTTPS} off |
| 27 | +#RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} |
| 28 | +#work for litespeed |
| 29 | +#RewriteCond %{HTTPS} !=on |
| 30 | +#RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] |
| 31 | + |
| 32 | + |
| 33 | +# Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin |
| 34 | +#RewriteCond %{HTTP_HOST} !^$ |
| 35 | +#RewriteCond %{HTTP_HOST} !^www\. [NC] |
| 36 | +#RewriteCond %{HTTP_HOST} (.+)$ |
| 37 | +#RewriteRule ^(.*)$ http://www.%1/$1 [R=permanent,L] . |
| 38 | + |
| 39 | +# without www |
| 40 | +#RewriteCond %{HTTP_HOST} . |
| 41 | +#RewriteCond %{HTTP_HOST} !^example\.com [NC] |
| 42 | +#RewriteRule (.*) http://example.com/$1 [R=301,L] |
| 43 | + |
| 44 | +# without www all domains |
| 45 | +#RewriteCond %{HTTP_HOST} . |
| 46 | +#RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC] |
| 47 | +#RewriteRule ^(.*)$ http://%1/$1 [R=301,L] |
| 48 | + |
| 49 | +# 301 that removes index.php?q= from all urls |
| 50 | +#RewriteCond %{THE_REQUEST} \s/+index\.php\?&q=([^\s&]+) [NC] |
| 51 | +#RewriteRule ^ /%1? [R=301,L] |
| 52 | +#RewriteCond %{THE_REQUEST} \s/+index\.php\?q=([^\s&]+) [NC] |
| 53 | +#RewriteRule ^ /%1? [R=301,L] |
| 54 | + |
| 55 | +# Exclude /assets and /manager directories and images from rewrite rules |
| 56 | +RewriteRule ^(manager|assets|js|css|images|img)/.*$ - [L] |
| 57 | +RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L] |
| 58 | + |
| 59 | +# For Friendly URLs |
| 60 | +RewriteCond %{REQUEST_FILENAME} !-f |
| 61 | +RewriteCond %{REQUEST_FILENAME} !-d |
| 62 | +RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] |
| 63 | + |
| 64 | +# Reduce server overhead by enabling output compression if supported. |
| 65 | +#php_flag zlib.output_compression On |
| 66 | +#php_value zlib.output_compression_level 5 |
0 commit comments