root/elgg/trunk/.htaccess

Revision 151, 11.7 kB (checked in by cedenoj, 1 year ago)

fixes #2833 The profile module now uses PARAM_SAFEDIR as defined in lib/constants.php to allow usernames that include underscores. This should allow the dino users to view and create their profiles. The .htaccess file was also modified so that dino users get pretty urls as well.

Line 
1 <IfModule !mod_rewrite.c>
2     # ugly ugly hack to detect missing mod_rewrite
3     # RedirectMatch must be to an absolute destination, so forces 500 error...
4     ErrorDocument 500 "Elgg error: Apache does not have mod_rewrite loaded. Please check your apache setup."
5     RedirectMatch 302 .* index.php
6 </IfModule>
7
8 <Files "htaccess-dist">
9     order allow,deny
10     deny from all
11 </Files>
12
13 # Don't listing directory
14 Options -Indexes
15
16 # Follow symbolic links
17 Options +FollowSymLinks
18
19 # Default handler
20 DirectoryIndex index.php
21
22 # php 4, apache 1.x
23 <IfModule mod_php4.c>
24         # default memory limit to 32Mb
25         php_value memory_limit 32M
26         # to make sure register global is off
27         php_value register_globals 0
28         # max post size to 8Mb
29         php_value post_max_size 8388608
30         # upload size limit to 5Mb     
31         php_value upload_max_filesize 5242880
32         # hide errors, enable only if debug enabled
33         php_value display_errors 0
34 </IfModule>
35
36 # php 4, apache 2
37 <IfModule sapi_apache2.c>
38         # default memory limit to 32Mb
39         php_value memory_limit 32M
40         # to make sure register global is off
41         php_value register_globals 0
42         # max post size to 8Mb
43         php_value post_max_size 8388608
44         # upload size limit to 5Mb     
45         php_value upload_max_filesize 5242880
46         # hide errors, enable only if debug enabled
47         php_value display_errors 0
48 </IfModule>
49
50 # php 5, apache 1 and 2
51 <IfModule mod_php5.c>
52         # default memory limit to 32Mb
53         php_value memory_limit 32M
54         # to make sure register global is off
55         php_value register_globals 0
56         # max post size to 8Mb
57         php_value post_max_size 8388608
58         # upload size limit to 5Mb     
59         php_value upload_max_filesize 5242880
60         # hide errors, enable only if debug enabled
61         php_value display_errors 0
62 </IfModule>
63
64 <IfModule mod_rewrite.c>
65
66 RewriteEngine on
67
68 # If Elgg is in a subdirectory on your site, you might need to add a RewriteBase line
69 # containing the path from your site root to elgg's root. e.g. If your site is
70 # http://example.com/ and Elgg is in http://example.com/sites/elgg/, you might need
71 #
72 #RewriteBase /sites/elgg/
73 RewriteBase /social/
74 #
75 # here, only without the # in front.
76 #
77 # If you're not running Elgg in a subdirectory on your site, but still getting lots
78 # of 404 errors beyond the front page, you could instead try:
79 #
80 #RewriteBase /
81
82 # Pages
83 ###########
84 RewriteRule ^content\/?(.*)?$ mod/pages/index.php?owner=-1&page=$1 [QSA,L]
85 RewriteRule ^([A-Za-z0-9_]+)\/content\/(.*)?$ mod/pages/index.php?profile_name=$1&page=$2  [QSA,L]
86
87 RewriteRule ^_templates(\/)?$ mod/template/index.php?%{QUERY_STRING}
88 RewriteRule ^_templates\/edit.php$ mod/template/edit.php?%{QUERY_STRING}
89 RewriteRule ^_templates\/preview.php$ mod/template/preview.php?%{QUERY_STRING}
90 RewriteRule ^_templates/css/(.+)$ mod/template/css.php?template=$1
91
92 RewriteRule ^(.+)\/rssstyles.xsl$ mod/newsclient/styles.php?rssurl=$1&url=$1
93
94 RewriteRule ^([A-Za-z0-9_]+)\/dashboard(\/)?$ mod/adash/index.php?user=$1
95
96 RewriteRule ^([A-Za-z0-9_]+)\/profile(\/)?$ profile/index.php?profile_name=$1
97 RewriteRule ^([A-Za-z0-9_]+)\/tags(\/)?$ search/personaltags.php?profile_name=$1
98 RewriteRule ^([A-Za-z0-9_]+)\/rss\/(.+)\/?$ profile/rss2.php?profile_name=$1&tag=$2
99
100 # Invite
101 #########
102 RewriteRule ^invite\/$ mod/invite/index.php
103 ReWriteRule ^invite\/join\/([A-Za-z0-9_]+)$ mod/invite/join.php?invitecode=$1
104 ReWriteRule ^register$ mod/invite/register.php
105 RewriteRule ^forgottenpassword$ mod/invite/forgotten_password.php
106 RewriteRule ^newpassword\/([A-Za-z0-9_]+)$ mod/invite/new_password.php?passwordcode=$1
107
108 RewriteRule ^([A-Za-z0-9_]+)(\/)?$ profile/index.php?profile_name=$1
109
110 # Activity
111 ###########
112 RewriteRule ^_activity\/$ mod/activity/index.php
113 RewriteRule ^_activity\/index.php$ mod/activity/index.php?%{QUERY_STRING}
114
115 # Communities
116 ##############
117 RewriteRule ^([A-Za-z0-9_]+)\/communities\/?$ mod/community/index.php?friends_name=$1
118 RewriteRule ^([A-Za-z0-9_]+)\/communities\/owned$ mod/community/owned.php?profile_name=$1
119 RewriteRule ^([A-Za-z0-9_]+)\/communities\/new$ mod/community/new.php?profile_name=$1
120 RewriteRule ^([A-Za-z0-9_]+)\/community\/delete$ mod/community/index.php?profile_name=$1&action=community:delete
121 RewriteRule ^([A-Za-z0-9_]+)\/community\/requests$ mod/community/requests.php?profile_name=$1
122 RewriteRule ^([A-Za-z0-9_]+)\/community\/requests\/aprove\/([0-9]+)$ mod/community/requests.php?profile_name=$1&action=community:approve:request&request_id=$2
123 RewriteRule ^([A-Za-z0-9_]+)\/community\/requests\/decline\/([0-9]+)$ mod/community/requests.php?profile_name=$1&action=community:decline:request&request_id=$2
124 RewriteRule ^([A-Za-z0-9_]+)\/community\/members$ mod/community/members.php?profile_name=$1
125 RewriteRule ^([A-Za-z0-9_]+)\/community\/add\/([0-9]+)$ mod/community/index.php?friends_name=$1&friend_id=$2&action=friend
126 RewriteRule ^([A-Za-z0-9_]+)\/community\/leave\/([0-9]+)$ mod/community/index.php?profile_name=$1&friend_id=$2&action=leave
127 RewriteRule ^([A-Za-z0-9_]+)\/community\/separate\/([0-9]+)$ mod/community/members.php?profile_name=$1&friend_id=$2&action=separate
128 RewriteRule ^community\/([0-9]+)\/?$ mod/communities/community.php?community_id=$1
129 RewriteRule ^([A-Za-z0-9_]+)\/community\/invite$ mod/community/invite.php?profile_name=$1
130 RewriteRule ^([A-Za-z0-9_]+)\/communities\/invitations$ mod/community/user_community_invitations.php?profile_name=$1
131
132 # Files
133 ########
134 RewriteRule ^([A-Za-z0-9_]+)\/files\/?$ mod/file/index.php?files_name=$1
135 RewriteRule ^([A-Za-z0-9_]+)\/files\/([0-9]+)\/?$ mod/file/index.php?files_name=$1&folder=$2
136 RewriteRule ^([A-Za-z0-9_]+)\/files\/([0-9\-]+)\/([0-9]+)\/(.+)$ mod/file/download.php?files_name=$1&folder=$2&filename=$4&id=$3
137 RewriteRule ^(([A-Za-z0-9_])[A-Za-z0-9_]+)\/files\/rss\/?$ mod/newsclient/static.php?username=$1&userref=$2&type=files
138 RewriteRule ^([A-Za-z0-9_]+)\/files\/rss\/(.+)\/?$ mod/file/rss2.php?files_name=$1&tag=$2
139 RewriteRule ^_icon\/file/([-0-9]+)$ mod/file/icon.php?id=$1
140 RewriteRule ^_files\/icon.php$ mod/file/icon.php?%{QUERY_STRING}
141
142 # Friends
143 ##########
144 RewriteRule ^([A-Za-z0-9_]+)\/friends\/?$ mod/friend/index.php?friends_name=$1
145 RewriteRule ^([A-Za-z0-9_]+)\/friendsof\/?$ mod/friend/friendsof.php?friends_name=$1
146 RewriteRule ^([A-Za-z0-9_]+)\/friends\/requests?$ mod/friend/requests.php?friends_name=$1
147 RewriteRule ^([A-Za-z0-9_]+)\/foaf\/?$ mod/friend/foaf.php?friends_name=$1
148
149 # Icons
150 ########
151 RewriteRule ^_icons\/$ mod/icons/index.php
152 RewriteRule ^_icon\/user/([-0-9]+)$ mod/icons/icon.php?id=$1
153 RewriteRule ^_icon\/user/([-0-9]+)\/([A-Za-z])\/([0-9]+)$ mod/icons/icon.php?id=$1&constraint1=$2&size1=$3
154 RewriteRule ^_icon\/user/([-0-9]+)\/([A-Za-z])\/([0-9]+)\/([A-Za-z])\/([0-9]+)$ mod/icons/icon.php?id=$1&constraint1=$2&size1=$3&constraint2=$4&size2=$5
155
156 # Tags
157 ###########
158
159 RewriteRule ^tag\/(.+)\/?$ search/all.php?tag=$1
160 RewriteRule ^rsstag\/(.+)\/?$ search/rss.php?tag=$1
161 RewriteRule ^tag\/(.+)/ecl\/?$ search/ecl.php?tag=$1
162
163
164 # Newsclient
165 ############
166 RewriteRule ^(([A-Za-z0-9_])[A-Za-z0-9_]+)\/rss\/?$ mod/newsclient/static.php?username=$1&userref=$2&type=profile
167 RewriteRule ^([A-Za-z0-9_]+)\/newsclient\/?$ mod/newsclient/subscriptions.php?profile_name=$1
168 RewriteRule ^([A-Za-z0-9_]+)\/newsclient\/all\/?$ mod/newsclient/index.php?profile_name=$1
169 RewriteRule ^([A-Za-z0-9_]+)\/newsclient\/all\/skip=([0-9]+)$ mod/newsclient/index.php?profile_name=$1&feed_offset=$2
170 RewriteRule ^([A-Za-z0-9_]+)\/feeds\/?$ mod/newsclient/subscriptions.php?profile_name=$1
171 RewriteRule ^([A-Za-z0-9_]+)\/feeds\/all\/?$ mod/newsclient/index.php?profile_name=$1
172 RewriteRule ^([A-Za-z0-9_]+)\/feeds\/all\/skip=([0-9]+)$ mod/newsclient/index.php?profile_name=$1&feed_offset=$2
173 RewriteRule ^_rss\/([A-Za-z_]+).php$ mod/newsclient/$1.php?%{QUERY_STRING}
174
175 # Users
176 ########
177 RewriteRule ^_userdetails\/$ mod/users/index.php?%{QUERY_STRING}
178 RewriteRule ^_userdetails\/index.php$ mod/users/index.php?%{QUERY_STRING}
179
180 # Weblog
181 ########
182 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/?$ mod/blog/index.php?weblog_name=$1
183 ReWriteRule ^([A-Za-z0-9_]+)\/weblog\/skip=([0-9]+)$ mod/blog/index.php?weblog_name=$1&weblog_offset=$2
184 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/edit$ mod/blog/edit.php?profile_name=$1
185 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/edit\/([0-9]+)$ mod/blog/edit.php?profile_name=$1&weblog_post_id=$2&action=edit
186 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/archive\/?$ mod/blog/archive.php?weblog_name=$1
187 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/archive\/([0-9]+)\/([0-9]+)\/?$ mod/blog/archive_month.php?weblog_name=$1&year=$2&month=$3
188 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/friends\/?$ mod/blog/friends.php?weblog_name=$1
189 ReWriteRule ^([A-Za-z0-9_]+)\/weblog\/friends\/skip=([0-9]+)$ mod/blog/friends.php?weblog_name=$1&weblog_offset=$2
190 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/interesting\/?$ mod/blog/interesting.php?weblog_name=$1
191 ReWriteRule ^([A-Za-z0-9_]+)\/weblog\/interesting\/skip=([0-9]+)$ mod/blog/interesting.php?weblog_name=$1&weblog_offset=$2
192 RewriteRule ^[A-Za-z0-9_]+\/weblog\/([0-9]+)\.html$ mod/blog/view_post.php?post=$1
193 RewriteRule ^[A-Za-z0-9_]+\/weblog\/([0-9]+)\.html.([0-9]+)$ mod/blog/view_post.php?post=$1&commentpage=$2
194 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/rss\/(.+)\/?$ mod/blog/rss2.php?weblog_name=$1&tag=$2&modifier=is
195 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/rssnot\/(.+)\/?$ mod/blog/rss2.php?weblog_name=$1&tag=$2&modifier=not
196 RewriteRule ^(([A-Za-z0-9_])[A-Za-z0-9_]+)\/weblog\/rss\/?$ mod/newsclient/static.php?username=$1&userref=$2&type=weblog
197 RewriteRule ^([A-Za-z0-9_]+)\/weblog\/category\/([^\/]+)\/?$ mod/blog/index.php?weblog_name=$1&filter=$2
198 ReWriteRule ^([A-Za-z0-9_]+)\/weblog\/category\/([^\/]+)\/skip=([0-9]+)$ mod/blog/index.php?weblog_name=$1&filter=$2&weblog_offset=$3
199 ReWriteRule ^weblog\/everyone$ mod/blog/everyone.php
200 ReWriteRule ^weblog\/everyone\/(people|communities|commented|uncommented)$ mod/blog/everyone.php?filter=$1
201 ReWriteRule ^weblog\/everyone\/skip/([0-9]+)$ mod/blog/everyone.php?weblog_offset=$1
202
203 # BeaverSource
204 ##############
205
206 #templates
207 #RewriteRule ^([A-Za-z0-9]+)\/([A-Za-z0-9]+)\/?$ mod/$2/index.php?profile_name=$1
208 #RewriteRule ^([A-Za-z0-9]+)\/([A-Za-z0-9]+)\/([A-Za-z0-9]+)\/?$ mod/$2/$3.php?profile_name=$1
209
210
211 #project modules
212 RewriteRule ^([A-Za-z0-9_]+)\/projects\/?$ mod/projects/index.php?profile_name=$1
213 RewriteRule ^([A-Za-z0-9_]+)\/projects\/([A-Za-z0-9_]+)\/?$ mod/projects/$2.php?profile_name=$1
214
215 #marketplace module
216 RewriteRule ^([A-Za-z0-9_]+)\/marketplace\/?$ mod/marketplace/index.php?profile_name=$1
217 RewriteRule ^([A-Za-z0-9_]+)\/marketplace\/([A-Za-z0-9_]+)\/?$ mod/marketplace/$2.php?profile_name=$1
218 RewriteRule ^([A-Za-z0-9_]+)\/marketplace\/interested\/([A-Za-z0-9_]+)\/([A-Za-z0-9_]+)\/?$ mod/marketplace/interested.php?profile_name=$1&cat=$2&id=$3
219 RewriteRule ^([A-Za-z0-9_]+)\/marketplace\/removead\/([A-Za-z0-9_]+)\/([A-Za-z0-9_]+)\/?$ mod/marketplace/removead.php?profile_name=$1&cat=$2&id=$3
220 RewriteRule ^([A-Za-z0-9_]+)\/marketplace\/editad\/([A-Za-z0-9_]+)\/([A-Za-z0-9_]+)\/?$ mod/marketplace/editad.php?profile_name=$1&cat=$2&id=$3
221
222 # RewriteRule ^([A-Za-z0-9]+)\/projects\/?$ mod/projects/index.php?profile_name=$1
223 # RewriteRule ^([A-Za-z0-9]+)\/projects\/search\/?$ mod/projects/search.php?profile_name=$1
224 # RewriteRule ^([A-Za-z0-9]+)\/projects\/browse\/?$ mod/projects/browse.php?profile_name=$1
225 # RewriteRule ^([A-Za-z0-9]+)\/projects\\/graveyard/?$ mod/projects/graveyard.php?profile_name=$1
226
227 # RewriteRule ^([A-Za-z0-9]+)\/marketplace\/?$ mod/marketplace/index.php?profile_name=$1
228 # RewriteRule ^([A-Za-z0-9]+)\/marketplace\/forhire\/?$ mod/marketplace/forhire.php?profile_name=$1
229 # RewriteRule ^([A-Za-z0-9]+)\/marketplace\/helpwanted\/?$ mod/marketplace/helpwanted.php?profile_name=$1
230 # RewriteRule ^([A-Za-z0-9]+)\/marketplace\/postad\/?$ mod/marketplace/postad.php?profile_name=$1
231
232
233
234
235 # Some blogging clients probe Wordpress or MoveableType endpoints,
236 # redirect them to the Elgg xml-rpc endpoint
237 #
238 RewriteRule xml-rpc.php _rpc/RPC2.php
239 RewriteRule mt/mt-xmlrpc.cgi _rpc/RPC2.php
240
241 # Rewrite rules for rpc transition to mod/ in v0.9+ so we don't break things
242 #
243 RewriteRule ^_rpc/RPC2.php$ mod/rpc/RPC2.php
244 RewriteRule ^_rpc/rsd.php$ mod/rpc/rsd.php?%{QUERY_STRING}
245
246 </IfModule>
Note: See TracBrowser for help on using the browser.