回答編集履歴

2

追記

2015/10/08 09:22

投稿

退会済みユーザー
test CHANGED
@@ -15,3 +15,141 @@
15
15
  参考:CodeIgniterでURLからindex.phpを除去する | Time to live forever
16
16
 
17
17
  http://unsolublesugar.com/20140906/151747/
18
+
19
+ ---
20
+
21
+ うちで実際に使っている .htaccess も参考に掲載します。
22
+
23
+ ```
24
+
25
+ # Multiple Environment config, set this to development, staging or production
26
+
27
+ # SetEnv FUEL_ENV production
28
+
29
+
30
+
31
+ <IfModule mod_rewrite.c>
32
+
33
+
34
+
35
+ RewriteEngine on
36
+
37
+
38
+
39
+ # NOTICE: If you get a 404 play with combinations of the following commented out lines
40
+
41
+ #AllowOverride All
42
+
43
+ #RewriteBase /wherever/fuel/is
44
+
45
+
46
+
47
+ # Make sure directory listing is disabled
48
+
49
+ Options +FollowSymLinks -Indexes
50
+
51
+
52
+
53
+ # Restrict your site to only one domain
54
+
55
+ # !important USE ONLY ONE OPTION
56
+
57
+
58
+
59
+ # Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
60
+
61
+ #RewriteCond %{HTTPS} !=on
62
+
63
+ #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
64
+
65
+ #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
66
+
67
+
68
+
69
+ # Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
70
+
71
+ #RewriteCond %{HTTPS} !=on
72
+
73
+ #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
74
+
75
+ #RewriteCond %{HTTP_HOST} (.+)$ [NC]
76
+
77
+ #RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
78
+
79
+
80
+
81
+ # Remove index.php from URL
82
+
83
+ #RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
84
+
85
+ #RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
86
+
87
+ #RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
88
+
89
+
90
+
91
+ # make HTTP Basic Authentication work on php5-fcgi installs
92
+
93
+ <IfModule mod_fcgid.c>
94
+
95
+ RewriteCond %{HTTP:Authorization} .
96
+
97
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
98
+
99
+ </IfModule>
100
+
101
+
102
+
103
+ # Send request via index.php if not a real file or directory
104
+
105
+ RewriteCond %{REQUEST_FILENAME} !-f
106
+
107
+ RewriteCond %{REQUEST_FILENAME} !-d
108
+
109
+
110
+
111
+ # deal with php5-cgi first
112
+
113
+ <IfModule mod_fcgid.c>
114
+
115
+ RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
116
+
117
+ </IfModule>
118
+
119
+
120
+
121
+ <IfModule !mod_fcgid.c>
122
+
123
+
124
+
125
+ # for normal Apache installations
126
+
127
+ <IfModule mod_php5.c>
128
+
129
+ RewriteRule ^(.*)$ index.php/$1 [L]
130
+
131
+ </IfModule>
132
+
133
+
134
+
135
+ # for Apache FGCI installations
136
+
137
+ <IfModule !mod_php5.c>
138
+
139
+ RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
140
+
141
+ </IfModule>
142
+
143
+
144
+
145
+ </IfModule>
146
+
147
+
148
+
149
+ </IfModule>
150
+
151
+
152
+
153
+ ```
154
+
155
+

1

加筆修正

2015/10/08 09:22

投稿

退会済みユーザー
test CHANGED
@@ -1,3 +1,5 @@
1
+ index.phpが置いてある箇所に、「.htaccess」を下記のように記述します。
2
+
1
3
  ```
2
4
 
3
5
  RewriteEngine on