-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.htaccess
64 lines (47 loc) · 2.33 KB
/
.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
IndexIgnore *
RewriteEngine On
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ $1 [R=301,L]
#DefaultType application/x-httpd-php
#DirectoryIndex index.php index.html
# Redirect external .php requests to extensionless url
#RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
#RewriteRule ^(.+)\.php$ $1 [R=301,L]
# Resolve .php file for extensionless php urls
#RewriteRule ^([^/.]+)$ $1.php [L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.php [NC,L]
# Removes .php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [NC,L]
#Remove Trailing Slash
#This snippet will redirect paths ending in slashes to their non-slash-terminated counterparts (except for actual directories),
#e.g. http://www.example.com/blog/ to http://www.example.com/blog. This is important for SEO, since it’s recommended to have a canonical URL for every page.
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} (.+)/$
#RewriteRule ^ %1 [R=301,L]
#Alias “Clean” URLs
#This snippet lets you use “clean” URLs -- those without a PHP extension, e.g. example.com/users instead of example.com/users.php.
#RewriteEngine On
#RewriteCond %{SCRIPT_FILENAME} !-d
#RewriteRule ^([^.]+)$ $1.php [NC,L]
#This example has an index.fcgi file in some directory, and any requests within that directory that fail to resolve a filename/directory
#will be sent to the index.fcgi script. It’s good if you want baz.foo/some/cool/path to be handled by baz.foo/index.fcgi
#(which also supports requests to baz.foo) while maintaining baz.foo/css/style.css and the like.
#Get access to the original path from the PATH_INFO environment variable, as exposed to your scripting environment.
#RewriteEngine On
#RewriteRule ^$ index.fcgi/ [QSA,L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]
#I want the url www.mysite.com/username to pass username as variable if is not a
#directory or file to index.php in myProfile directory where it is access as $user = $_GET['u'];
#RewriteBase /
#Options All -Indexes
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /u/index.php?u=$1 [L,QSA]