質問するログイン新規登録

回答編集履歴

2

追記

2015/10/08 09:22

投稿

退会済みユーザー
answer CHANGED
@@ -6,4 +6,72 @@
6
6
  ```
7
7
 
8
8
  参考:CodeIgniterでURLからindex.phpを除去する | Time to live forever
9
- http://unsolublesugar.com/20140906/151747/
9
+ http://unsolublesugar.com/20140906/151747/
10
+ ---
11
+ うちで実際に使っている .htaccess も参考に掲載します。
12
+ ```
13
+ # Multiple Environment config, set this to development, staging or production
14
+ # SetEnv FUEL_ENV production
15
+
16
+ <IfModule mod_rewrite.c>
17
+
18
+ RewriteEngine on
19
+
20
+ # NOTICE: If you get a 404 play with combinations of the following commented out lines
21
+ #AllowOverride All
22
+ #RewriteBase /wherever/fuel/is
23
+
24
+ # Make sure directory listing is disabled
25
+ Options +FollowSymLinks -Indexes
26
+
27
+ # Restrict your site to only one domain
28
+ # !important USE ONLY ONE OPTION
29
+
30
+ # Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
31
+ #RewriteCond %{HTTPS} !=on
32
+ #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
33
+ #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
34
+
35
+ # Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
36
+ #RewriteCond %{HTTPS} !=on
37
+ #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
38
+ #RewriteCond %{HTTP_HOST} (.+)$ [NC]
39
+ #RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
40
+
41
+ # Remove index.php from URL
42
+ #RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
43
+ #RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
44
+ #RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
45
+
46
+ # make HTTP Basic Authentication work on php5-fcgi installs
47
+ <IfModule mod_fcgid.c>
48
+ RewriteCond %{HTTP:Authorization} .
49
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
50
+ </IfModule>
51
+
52
+ # Send request via index.php if not a real file or directory
53
+ RewriteCond %{REQUEST_FILENAME} !-f
54
+ RewriteCond %{REQUEST_FILENAME} !-d
55
+
56
+ # deal with php5-cgi first
57
+ <IfModule mod_fcgid.c>
58
+ RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
59
+ </IfModule>
60
+
61
+ <IfModule !mod_fcgid.c>
62
+
63
+ # for normal Apache installations
64
+ <IfModule mod_php5.c>
65
+ RewriteRule ^(.*)$ index.php/$1 [L]
66
+ </IfModule>
67
+
68
+ # for Apache FGCI installations
69
+ <IfModule !mod_php5.c>
70
+ RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
71
+ </IfModule>
72
+
73
+ </IfModule>
74
+
75
+ </IfModule>
76
+
77
+ ```

1

加筆修正

2015/10/08 09:22

投稿

退会済みユーザー
answer CHANGED
@@ -1,3 +1,4 @@
1
+ index.phpが置いてある箇所に、「.htaccess」を下記のように記述します。
1
2
  ```
2
3
  RewriteEngine on
3
4
  RewriteCond $1 !^(index\.php|images|robots\.txt)