Adding redirects in htaccess and removing certificates folder, news_list.php and user.php

skala
Julio Montoya 13 years ago
parent e27d28559f
commit 2dbf1c8b78
  1. 15
      .htaccess
  2. 10
      certificates/index.php
  3. 9
      news_list.php
  4. 11
      user.php

@ -5,6 +5,7 @@
RewriteEngine On
RewriteBase /
# Courses home
RewriteCond %{QUERY_STRING} ^id_session=0
RewriteRule ^courses/(.*)/(.*)$ web/courses/$1? [R,L]
@ -15,7 +16,19 @@
RewriteRule ^courses/(.*)/$ web/courses/$1? [R,L]
RewriteRule ^certificates/(.*)/$ web/courses/$1? [R,L]
# Certificates
# certificates/index.php?id=1 => web/certificates/1
RewriteCond %{QUERY_STRING} ^id=([0-9]*)
RewriteRule ^certificates/(.*)$ web/certificates/%1? [R,L]
# User profile
# user.php?admin => web/user/admin
RewriteCond %{QUERY_STRING} ^([a-z0-9A-z]*)
RewriteRule ^user.php?$ web/user/%1? [R,L]
# News
RewriteCond %{QUERY_STRING} ^id=([0-9]*)
RewriteRule ^news_list.php?$ web/news/%1? [R,L]
</IfModule>

@ -1,10 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
//Redirects to web/certificates/X
require_once '../main/inc/global.inc.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$url = Certificate::getCertificatePublicURL($id);
header("Location: $url");
exit;

@ -1,9 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
//Temporal hack to redirect calls to the new web/index.php
require_once 'main/inc/global.inc.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$path = api_get_path(WEB_PUBLIC_PATH);
header('Location: '.$path.'news/'.$id);
exit;

@ -1,11 +0,0 @@
<?php
//Redirects calls to user.php?admin to web/user/admin
require_once 'main/inc/global.inc.php';
$path = api_get_path(WEB_PUBLIC_PATH);
$array_keys = isset($_GET) ? array_keys($_GET) : null;
if (!empty($array_keys)) {
$username = Security::remove_XSS(substr($array_keys[0], 0, 100)); // max len of an username
header('Location: '.$path.'user/'.$username);
}
exit;
Loading…
Cancel
Save