Skip to content

Commit

Permalink
Force Mibew to work without mod_rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
JustBlackBird committed Sep 10, 2014
1 parent 7c969e4 commit 86085a0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/mibew/.htaccess
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Set default handler for incoming requests
DirectoryIndex index.php

# Disable directory listing
Options -Indexes

Expand All @@ -26,6 +23,9 @@ Options +FollowSymLinks

# Redirect requests to the front controller
<IfModule mod_rewrite.c>
# Use the front controller as a default handler
DirectoryIndex index.php

RewriteEngine On

# Use separate front controller for the system installator
Expand All @@ -40,6 +40,13 @@ Options +FollowSymLinks
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
# There is no mod_rewrite in the system. For the root Mibew directory
# index_fallback.php should be loaded first to activate old-fashioned URLs.
# For all other directories index.php is just a directory index file.
DirectoryIndex index_fallback.php index.php
</IfModule>

# Deny access to internal system files
<FilesMatch "\.(yml|po|ini|handlebars|keep)$">
Deny from all
Expand Down
23 changes: 23 additions & 0 deletions src/mibew/index_fallback.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/*
* This file is a part of Mibew Messenger.
*
* Copyright 2005-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Force the user to specify the entry point. This should be done only when
// mod_rewrite is not used by apache.
header('HTTP/1.0 301 Moved Permanently');
header('Location: index.php/');

0 comments on commit 86085a0

Please sign in to comment.