1+ # ---------------------------------------------------------
2+ # Enable Apache mod_rewrite for clean and dynamic URL handling
3+ # ---------------------------------------------------------
14RewriteEngine On
5+
6+ # ---------------------------------------------------------
7+ # Define the base URL path for the rewrite rules
8+ # Adjust this if the project is in a subfolder (e.g., /myapp/)
9+ # ---------------------------------------------------------
210RewriteBase /
11+
12+ # ---------------------------------------------------------
13+ # Prevent rewriting the index.php file itself
14+ # This ensures direct access to index.php remains unchanged
15+ # ---------------------------------------------------------
316RewriteRule ^index\.php$ - [L]
17+
18+ # ---------------------------------------------------------
19+ # Condition: Requested resource does NOT match an existing file
20+ # ---------------------------------------------------------
421RewriteCond %{REQUEST_FILENAME} !-f
22+
23+ # ---------------------------------------------------------
24+ # Condition: Requested resource does NOT match an existing directory
25+ # ---------------------------------------------------------
526RewriteCond %{REQUEST_FILENAME} !-d
27+
28+ # ---------------------------------------------------------
29+ # Redirect all other requests to index.php
30+ # This allows a single PHP entry point to handle routing
31+ # ---------------------------------------------------------
632RewriteRule . /index.php [L]
33+
34+ # =========================================================
35+ # Additional Security Headers (Optional but Recommended)
36+ # =========================================================
37+
38+ # Prevent MIME type sniffing by browsers
39+ Header set X-Content-Type-Options "nosniff"
40+
41+ # Disallow embedding the site in iframes to prevent clickjacking
42+ Header set X-Frame-Options "DENY"
43+
44+ # Enforce secure HTTP Referrer Policy
45+ Header always set Referrer-Policy "no-referrer-when-downgrade"
46+
47+ # Mitigate some cross-site scripting (XSS) attacks
48+ Header set X-XSS-Protection "1 ; mode=block"
0 commit comments