-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
32 lines (24 loc) · 993 Bytes
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
RewriteEngine On
# Redirect to index if no file is specified
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^(.*)$ http://%{SERVER_NAME}/pages/404
# Disable directory browsing and Redirect to 404
# Options -Indexes
# RewriteCond %{REQUEST_FILENAME} -d
# RewriteRule ^(.*)$ http://%{SERVER_NAME}/pages/404.php
# Redirect 404 to a custom page
ErrorDocument 403 https://projets.iut-orsay.fr/triominos/pages/404
ErrorDocument 404 https://projets.iut-orsay.fr/triominos/pages/404
# Hide .php extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# Redirect .php to the same url without .php
# RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php(.*) [NC]
# RewriteCond %{REQUEST_FILENAME} !index.php [NC]
# RewriteRule ^ %1 [R=301,L]
# Redirect /index to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php(.*) [NC]
RewriteRule ^ %1/ [R=301,L]
# Redirect .php/something to 404
RewriteCond %{REQUEST_URI} ^(.*)\.php/(.*)$ [NC]
RewriteRule ^ - [R=404,L]