Isse-bo commited on
Commit
09e9945
·
verified ·
1 Parent(s): cd2ff46

Update .htaccess with custom content

Browse files
Files changed (1) hide show
  1. .htaccess +49 -0
.htaccess ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Enable mod_rewrite
2
+ RewriteEngine On
3
+
4
+ # PHP settings for better performance and database handling
5
+ <IfModule mod_php7.c>
6
+ php_value max_execution_time 300
7
+ php_value memory_limit 256M
8
+ php_value max_input_time 300
9
+ php_value post_max_size 64M
10
+ php_value upload_max_filesize 64M
11
+ php_value default_socket_timeout 300
12
+ php_value mysql.connect_timeout 300
13
+ php_value session.gc_maxlifetime 14400
14
+ </IfModule>
15
+
16
+ <IfModule mod_php.c>
17
+ php_value max_execution_time 300
18
+ php_value memory_limit 256M
19
+ php_value max_input_time 300
20
+ php_value post_max_size 64M
21
+ php_value upload_max_filesize 64M
22
+ php_value default_socket_timeout 300
23
+ php_value mysql.connect_timeout 300
24
+ php_value session.gc_maxlifetime 14400
25
+ </IfModule>
26
+
27
+ # Redirect /index to /
28
+ RewriteRule ^index$ / [R=301,L]
29
+
30
+ # Remove trailing slash if it exists (in subfolders)
31
+ RewriteCond %{REQUEST_URI} /$
32
+ RewriteCond %{REQUEST_FILENAME} !-d
33
+ RewriteRule ^(.*)/$ /$1 [R=301,L]
34
+
35
+ # Redirect requests with .php to clean URLs
36
+ RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php[\s?/] [NC]
37
+ RewriteRule ^ %1 [R=301,L]
38
+
39
+ # Handle subfolder requests and remove .php extension
40
+ RewriteCond %{REQUEST_FILENAME}.php -f
41
+ RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)$ [NC]
42
+ RewriteRule ^([^/]+)/([^/]+)$ /$1/$2.php [L]
43
+
44
+ # Remove .php extension internally (but allow it to be accessed without .php)
45
+ RewriteCond %{REQUEST_FILENAME}.php -f
46
+ RewriteRule ^([^/.]+)$ $1.php [L]
47
+
48
+ # Custom error pages
49
+ ErrorDocument 404 /404.php