mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 19:42:38 +02:00
100 lines
4.3 KiB
Text
100 lines
4.3 KiB
Text
# Deny access to all sensitive file types and prevent execution
|
|
<FilesMatch "(?i)\.(php[a-z0-9]?|phtml|sh|log|lock|bat|bin|cmd|com|cpl|exe|gadget|inf1|ins|inx|isu|job|jse|lnk|msc|msi|msp|mst|paf|pif|ps1|reg|rgs|scr|sct|shb|shs|u3p|vb|vbe|vbs|vbscript|ws|wsf|wsh|bak|config|inc|bkp)$">
|
|
<IfModule !authz_core_module>
|
|
Order Allow,Deny
|
|
Deny from all
|
|
</IfModule>
|
|
<IfModule authz_core_module>
|
|
Require all denied
|
|
</IfModule>
|
|
</FilesMatch>
|
|
|
|
# Allow access to specific file types only
|
|
<FilesMatch "(?i)\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|ts|txt|mp4|mp3|m3u8|webp|key|css|tff|woff|woff2|webm|js|ttf|sql)$">
|
|
<IfModule !authz_core_module>
|
|
Order Allow,Deny
|
|
Allow from all
|
|
</IfModule>
|
|
<IfModule authz_core_module>
|
|
Require all granted
|
|
</IfModule>
|
|
</FilesMatch>
|
|
|
|
# Deny access to all hidden files and directories (those starting with a dot)
|
|
<FilesMatch "^\.">
|
|
<IfModule !authz_core_module>
|
|
Order Allow,Deny
|
|
Deny from all
|
|
</IfModule>
|
|
<IfModule authz_core_module>
|
|
Require all denied
|
|
</IfModule>
|
|
</FilesMatch>
|
|
|
|
# Prevent directory listing
|
|
Options -Indexes
|
|
|
|
# Prevent script execution by changing MIME type to text/plain
|
|
RemoveHandler .php .phtml .py .cgi .pl .sh
|
|
AddType text/plain .php .phtml .py .cgi .pl .sh
|
|
|
|
# Deny access to all .php files explicitly
|
|
<Files "*.php">
|
|
<IfModule !authz_core_module>
|
|
Order Allow,Deny
|
|
Deny from all
|
|
</IfModule>
|
|
<IfModule authz_core_module>
|
|
Require all denied
|
|
</IfModule>
|
|
</Files>
|
|
|
|
<IfModule mod_rewrite.c>
|
|
RewriteEngine On
|
|
|
|
# Block requests from specific referrers (video downloading sites)
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?cdpn\.io [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?m3u8\.cococut\.net [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?savefrom\.net [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?keepvid\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?y2mate\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?yt1s\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?ssyoutube\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?youtubnow\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?clipconverter\.cc [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?fetchfile\.net [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?savethevideo\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?video-download\.online [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?videograbby\.com [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?9xbuddy\.org [NC,OR]
|
|
RewriteCond %{HTTP_REFERER} ^https?://(www\.)?downvids\.net [NC]
|
|
|
|
# Block access and return a 403 Forbidden status
|
|
RewriteRule .* - [F,L]
|
|
|
|
RewriteRule ^webfonts/(fa-.*) ../view/css/fontawesome-free-5.5.0-web/webfonts/$1 [NC,L]
|
|
RewriteRule ^([^/]+)/(.*).key$ ../plugin/VideoHLS/downloadProtection.php?filename=$1&key=$2 [QSA]
|
|
RewriteRule ^fonts/(.+)$ ../view/bootstrap/fonts/$1 [NC,L]
|
|
RewriteRule ^(.*)/index.m3u8$ ../view/hls.php?videoDirectory=$1 [NC,L,QSA]
|
|
RewriteRule ^(.*)/index.m3u8.mp4$ ../view/hls.php?playHLSasMP4=1&videoDirectory=$1 [NC,L,QSA]
|
|
RewriteCond %{REQUEST_URI} ^userPhoto/photo([0-9]+)\.png$
|
|
<IfModule mod_xsendfile.c>
|
|
# Allow direct access to files in the convertedMP4 directory
|
|
RewriteRule ^convertedMP4/([0-9]+(\.(mp4|webm|m3u8|mp3|ogg|jpg)))$ convertedMP4/$1 [L,END]
|
|
|
|
# Rewrite other URLs to xsendfile.php
|
|
RewriteRule ^([_A-Za-z0-9.-]+/)?([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ ../view/xsendfile.php?file=$2&folder=$1 [QSA,END]
|
|
RewriteRule ^cache/download/([_A-Za-z0-9.-]+/)?([^!#$&'()*+,\/:;=?@[\]]+(\.(mp4|webm|m3u8|mp3|ogg)))$ ../view/xsendfile.php?file=$2&cacheDownload=1 [QSA,END]
|
|
</IfModule>
|
|
|
|
# Special redirect for videos/userPhoto/photo[0-9]+.png to user/[0-9]+/foto.png if not found
|
|
RewriteCond %{REQUEST_URI} ^/videos/userPhoto/photo([0-9]+)\.png$
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^ /user/%1/foto.png [L,R=302]
|
|
|
|
# if image does not exist
|
|
RewriteCond %{REQUEST_URI} \.(webp|jpg|jpeg|gif|png|ico)$ [NC]
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule (.*)$ ../img/image404.php?image=$1 [NC,L]
|
|
</IfModule>
|