0
PHPフレームワークのCodeIgnitorの.htaccessに次のコードを使用しています。CodeIgnitorフレームワークを使用しているときにURLがディレクトリの前に疑問符が表示されるのはなぜですか?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$/[L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
#RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
#RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
# Enforce NO www
#RewriteCond %{HTTP_HOST} ^www [NC]
#RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
###
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index\.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index\.php/$1 [L]
私は、URL http://linuxservers.org/articlesで記事ページを入力した場合(インデックスはありません)をロードしません。しかし、linuxservers.org/?articlesや/?/ articlesを入力すると、ページが読み込まれます。理解できません。それに加えて
、私は上記のコードの最後の行を変更した場合に
RewriteRule ^(.*)$ index\.php/?$1 [L]
OR
RewriteRule ^(.*)$ index\.php?/$1 [L]
(/?記事または/?/記事のいずれかへ/記事をリダイレクトしますページがロードされます。 index.php/articlesは、CodeIgnitorのデフォルトフォーマットであるページも読み込みます。
うまくいけば、それは意味がありませんでした。あなたの入力に転送します。
それは "作品"ですが、URLは/記事の代わりに/?/ articlesとして表示されます。 – Chris
/記事を/?/記事にリダイレクトします。 /?/ articlesはその行なしで記事ページを読み込みます。 – Chris
ああ、私はあなたが持っていた問題を誤解したと思う。 '[L]'フラグの使用に関連している可能性が最も高く、ここを見てください:http://www.easymodrewrite.com/notes-last –