Forum Moderators: phranque
RewriteEngine On
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin$ access.php [NC,QSA]
RewriteRule ^admin/(.*)$ access.php?page=$1 [NC,QSA]
RewriteRule ^admin/(.*)$ admin-panel/$1 [L]
RewriteRule ^$ index.php?url=home [NC,QSA]
#--RewriteRule ^([^\/]+)(\/|)$ index.php?url=$1 [QSA]
RewriteRule ^404$ index.php?url=404 [L,QSA]
RewriteRule ^s/([^\/]+)(\/|)?$ index.php?url=share&share=$1 [L,QSA]
RewriteRule ^media/([^\/]+)(\/|)?$ index.php?url=home&media=$1 [L,QSA]
RewriteRule ^lang/([^\/]+)(\/|)?$ index.php?url=lang&lang=$1 [L,QSA]
RewriteRule ^page/([^\/]+)(\/|)?$ index.php?url=page&page=$1 [L,QSA]
RewriteRule ^articles(\/|)$ index.php?url=articles [NC,QSA]
RewriteRule ^articles/([^\/]+)(\/|)?$ index.php?url=articles&id=$1 [L,QSA]
RewriteRule ^articles/([^\/]+)/post/([^\/]+)(\/|)?$ index.php?url=articles&id=$1&post=$2 [L,QSA]
#
RewriteRule ^watch/?$ index.php?url=watch&id=$1 [QSA]
#lang
RewriteRule ^es/$ index.php?lang=es [QSA,L]
RewriteRule ^en/$ index.php?lang=en [QSA,L]
RewriteRule ^de/$ index.php?lang=de [QSA,L]
RewriteRule ^fr/$ index.php?lang=fr [QSA,L]
RewriteRule ^it/$ index.php?lang=it [QSA,L]
RewriteRule ^pt/$ index.php?lang=pt [QSA,L]
RewriteRule ^ru/$ index.php?lang=ru [QSA,L]
RewriteRule ^tr/$ index.php?lang=tr [QSA,L]
RewriteRule ^zh/$ index.php?lang=zh [QSA,L]
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^@([^\/]+)(\/|)$ index.php?url=home&media=$1 [QSA]
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9_]+)/([^\/]+)(\/|)$ index.php?url=home&media=$1&type=$2 [QSA]
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\/]+)(\/|)$ index.php?url=home&media=$1 [QSA]
#
<IfModule mod_rewrite.c>
#Enable URL rewriting
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] [edited by: not2easy at 10:57 am (utc) on May 5, 2020]
[edit reason] example.com / readability [/edit]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L] so that the domain name is in the rule target along with the query for the /extra/ directory. RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Was something inadvertently edited-out here? The Conditions would apply only to the immediately following rule, whose pattern is RewriteRule ^admin/(.*)$ access.php?page=$1 [NC,QSA]
RewriteRule ^admin/(.*)$ admin-panel/$1 [L]When would the second rule ever deploy, if all requests for /admin/blahblah have already been rewritten? RewriteRule ^es/$ index.php?lang=es [QSA,L]
RewriteRule ^en/$ index.php?lang=en [QSA,L]
RewriteRule ^de/$ index.php?lang=de [QSA,L]
RewriteRule ^fr/$ index.php?lang=fr [QSA,L]
RewriteRule ^it/$ index.php?lang=it [QSA,L]
RewriteRule ^pt/$ index.php?lang=pt [QSA,L]
RewriteRule ^ru/$ index.php?lang=ru [QSA,L]
RewriteRule ^tr/$ index.php?lang=tr [QSA,L]
RewriteRule ^zh/$ index.php?lang=zh [QSA,L]All this could easily be expressed as a single rule: RewriteRule ^(e[ns]|de|fr|it|pt|ru|tr|zh)/$ index.php?lang=$1 [QSA,L] ^([^\/]+)(\/|)$The slash / doesn’t need to be escaped inside grouping brackets, or anywhere else in mod_rewrite. And what’s that lone | doing right at the end? Did something get edited-out again?
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
https://ibb.co/F4Wbrrf
https://ibb.co/L9dxYcT
https://www.example.com/en/new-portals/admin/
<?php
$http_header = 'http://';
if (!empty($_SERVER['HTTPS'])) {
$http_header = 'https://';
}
$this_url = $http_header . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$this_url = str_replace('admin-panel', 'admin', $this_url);
header("Location: $this_url");
exit();
?>
<?php
//-->
if (@$_COOKIE["_admin_user"]!='') {
if (IS_LOGGED_DATA($_COOKIE["_admin_user"])) {
echo 'EE_NO_ADMIN';
@header("Location:./logout");
}
}else{
//-->
}
//-->
$page = 'dashboard';
if (!empty($_GET['page'])) {
$page = PHP_Secure($_GET['page']);
}
//-->
$load_header = '';
$page_loaded = '';
$pages = array(
'logout',
'dashboard',
'plugins',
'upload_plugin',
'ads',
'server',
'settings',
'urls',
'report',
'comments',
'blogs',
'documentation',
'user'
);
//-->
if (@$_COOKIE["_admin_user"]!='') {
if (in_array($page, $pages)) {
$fichero_sistem = PHP_File_admin_system($page);
if (file_exists($fichero_sistem)) {
require_once $fichero_sistem;
} else {
}
//--> Header
$load_header = PHP_AdminLoadPage("header/content");
$page_loaded = PHP_AdminLoadPage("$page/content");
}else{
$page_loaded = PHP_AdminLoadPage("error/content");
}
}else{
require_once 'system_php/page_login.php';
$page_loaded = PHP_AdminLoadPage("login/content");
}
?>
<IfModule mod_rewrite.c>
#Enable URL rewriting
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#Replace [yourdomain] (including the brackets!) with your domain name to redirect 'www' subdomain to root domain
#RewriteCond %{HTTP_HOST} ^www\.[yourdomain]\.com
#RewriteRule (.*) http://[yourdomain].com/$1 [R=301,L]
#Change this to the _relative path_ of your app root directory (folder that contains your app files).
#Don't include the url protocol and domain!
#For example, the value '/VideoConverter-Linux-SVN/' is valid for an app url of 'http://www.yoursite.com/VideoConverter-Linux-SVN/'.
#Comment out this line or set value to '/' if your app files are directly in the web root.
RewriteBase /
#Rewrite conditions for "pretty" direct-to-conversion URLs
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#Rewrite rule for "pretty" direct-to-conversion URLs
#Add more video hosting site abbreviations and/or file types as needed (See Config class file for valid values)
#If conversion software is in iframe, and parent frame file is in different directory, move this rewrite rule to parent frame directory's .htaccess file, AND
#You may have to replace "index.php" with "http://www.yourdomain.com/index.php" (if parent frame file is in web root directory)
RewriteRule ^(((yt|dm|vm|fb|mc|vk|sc|ig|al|rt|xv|ph|vv|gd|tw)/)(.+?)(/(mp3|aac|m4a|mp4|webm|f4v|3gp))?(/(128|256))?)$ index.php?vidHost=$3&vidID=$4&ftype=$6&quality=$8 [QSA,L,R]
#Uncomment the following lines as instructed to redirect all http:// requests to https://
#If using Cloudflare SSL, uncomment this line
RewriteCond %{HTTP:CF-Visitor} {"scheme":"http"}
#If NOT using Cloudflare SSL, uncomment this line
#RewriteCond %{HTTPS} off
#Always uncomment these lines
RewriteCond %{REQUEST_URI} !(.mp3|.aac|.m4a|.mp4|.webm|.f4v|.3gp)$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
https://ibb.co/PgM2HNZ
162.xxx.xx.xx - - [05/May/2020:22:31:38 +0200] "GET / HTTP/1.1" 200 13340 "-" "Mozilla/5.0 (Linux; Android 8.1.0; K6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile Safari/537.36"
172.xx.xxx.xxx - - [05/May/2020:22:31:39 +0200] "POST /en/new-portals/admin/ HTTP/1.1" 500 4014 "https://www.example.com/en/new-portals/admin/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
172.xx.xxx.xx - - [05/May/2020:22:31:47 +0200] "GET / HTTP/1.1" 200 13210 "-" "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-G975F Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/9.2 Chrome/67.0.3396.87 Mobile Safari/537.36"
162.xxx.xxx.xxx - - [05/May/2020:22:31:48 +0200] "GET /index.php?vidID=aA_kuFTV-P8'&vidHost=youtube'&ftype=mp3'&ccode=CN'\" HTTP/1.1" 200 13365 "-" "-"
[Wed May 06 01:38:18.728273 2020] [php7:error] [pid 23691] [client 1xx.xx.xxx.xxx:11822] PHP Fatal error: Uncaught Error: Call to undefined function bcpow() in /home/example/public_html/en/new-portals/application/system/function_security.php:75\nStack trace:\n#0 /home/example/public_html/en/new-portals/admin-panel/system_php/page_login.php(33): PHP_Crypt_code('573153446184435')\n#1 /home/example/public_html/en/new-portals/admin-panel/pages_load.php(53): require_once('/home/example...')\n#2 /home/example/public_html/en/new-portals/access.php(11): require('/home/example...')\n#3 {main}\n thrown in /home/example/public_html/en/new-portals/application/system/function_security.php on line 75, referer: https://www.example.com/en/new-portals/admin/
sudo apt install php7.4-bcmath now the blank page issue is gone however admin page not loading taking me to https://www.example.com/en and in there giving me "Forbidden en/new-portal or any other directory