|
1
|
+ |
<IfModule mod_rewrite.c>
|
|
2
|
+ |
Options +FollowSymLinks
|
|
3
|
+ |
Options -MultiViews
|
|
4
|
+ |
RewriteEngine On
|
|
5
|
+ |
RewriteBase /
|
|
6
|
+ |
|
|
7
|
+ |
# Redirect everything to HTTPS
|
|
8
|
+ |
RewriteCond %{HTTPS} off
|
|
9
|
+ |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
10
|
+ |
|
|
11
|
+ |
# Remove www
|
|
12
|
+ |
RewriteCond %{HTTP_HOST} ^www\.freepo\.st$ [NC]
|
|
13
|
+ |
RewriteRule ^(.*)$ https://freepo.st/$1 [R=301]
|
|
14
|
+ |
|
|
15
|
+ |
# Remove trailing slashes
|
|
16
|
+ |
RewriteRule (.*)/+$ https://freepo.st/$1 [NC,R=301,QSA]
|
|
17
|
+ |
|
|
18
|
+ |
# Rewrite for public assets
|
|
19
|
+ |
RewriteRule .+/css/(.+)$ css/$1 [NC,L,QSA]
|
|
20
|
+ |
RewriteRule .+/images/(.+)$ images/$1 [NC,L,QSA]
|
|
21
|
+ |
RewriteRule .+/javascript/(.+)$ javascript/$1 [NC,L,QSA]
|
|
22
|
+ |
|
|
23
|
+ |
# community/[community name]/post/[post hash_id]/[post title]/comment/[comment hash_id]
|
|
24
|
+ |
RewriteRule community/.+/post/(.+)/.+/comment/(.+)$ post/$1#comment-$2 [NC,NE,L,QSA,R=301]
|
|
25
|
+ |
# Redirect old urls
|
|
26
|
+ |
RewriteRule community/.+/post/(.+)/.+$ post/$1 [NC,L,QSA,R=301]
|
|
27
|
+ |
RewriteRule community/.+/post/(.+)/*$ post/$1 [NC,L,QSA,R=301]
|
|
28
|
+ |
# community/[community name]
|
|
29
|
+ |
RewriteRule community/.+$ / [NC,L,QSA,R=301]
|
|
30
|
+ |
|
|
31
|
+ |
# Redirect /new to index.php
|
|
32
|
+ |
RewriteRule ^new$ index.php?new [NC,L,QSA]
|
|
33
|
+ |
|
|
34
|
+ |
# For votes from post/...
|
|
35
|
+ |
RewriteRule post/vote$ vote.php [NC,L,QSA]
|
|
36
|
+ |
|
|
37
|
+ |
# Show a post's page
|
|
38
|
+ |
RewriteRule post/(.+)$ post.php?hash_id=$1 [NC,L,QSA]
|
|
39
|
+ |
|
|
40
|
+ |
# Show a user's public profile
|
|
41
|
+ |
RewriteRule user/(.+)$ user.php?username=$1 [NC,L,QSA]
|
|
42
|
+ |
|
|
43
|
+ |
# Show a user's activity (private only)
|
|
44
|
+ |
RewriteRule user_activity/(.+)$ user_activity.php?$1 [NC,L,QSA]
|
|
45
|
+ |
|
|
46
|
+ |
# RSS
|
|
47
|
+ |
RewriteRule ^rss/(.+)$ rss.php?sort=$1 [NC,L,QSA]
|
|
48
|
+ |
RewriteRule ^rss$ rss/hot [NC,L,R=301]
|
|
49
|
+ |
|
|
50
|
+ |
# Rewrite to the corresponding .php page
|
|
51
|
+ |
# Not a directory
|
|
52
|
+ |
RewriteCond %{REQUEST_FILENAME} !-d
|
|
53
|
+ |
# A HTML file exists
|
|
54
|
+ |
RewriteCond %{REQUEST_FILENAME}\.php -f
|
|
55
|
+ |
# Route URL to the right HTML page
|
|
56
|
+ |
RewriteRule (.+) $1.php [NC,L,QSA]
|
|
57
|
+ |
|
|
58
|
+ |
# If the requested filename exists, simply serve it.
|
|
59
|
+ |
# We only want to let Apache serve files and not directories.
|
|
60
|
+ |
RewriteCond %{REQUEST_FILENAME} -f
|
|
61
|
+ |
RewriteRule .? - [L]
|
|
62
|
+ |
</IfModule> |
|
62
|
< |
\ No newline at end of file
|