これは私のURLが現在どのように見えるかです:
http://mysite.com/?page=1
どうすればこれを機能させることができますか?:
http://mysite.com/page/1
同じ質問をする StackOverflow に関する投稿があります。しかし、受け入れられた解決策は私にとってはうまくいきません。私は Codeigniter を使用しており、ページが 404 になるため、おそらく CI サイトの URL パターンが次のようになっているためです。
ドメイン/コントローラー/メソッド
システムは、"page" というコントローラーと "1" というメソッドを要求していると想定していますが、どちらももちろん存在しません。あるいは、私の htaccess ファイル (CI wiki からダウンロードしたもので、index.php を削除し、いくつかのセキュリティ処理を実行します) 内の他のコードとの競合が原因である可能性があります。ここに私のhtaccessファイル全体があります:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users. Additionally this will allow you to create a System.php controller, 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder. This snippet prevents user access to the application folder. Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
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]
#Pretty urls for pagination links
RewriteRule (.*) index.php?page=$1
</IfModule>
インデントされていないビットは、私にとってはうまくいかない他のSOの質問から得た解決策です。
この CI ページネーションの問題に対する解決策はありますか?
アップデート
わかりました、いくつかのドキュメントを読んでください。今、私はこれを機能させています:
http://mysite.com/home/index/2
それを変換する htaccess ルールは何でしょうか?:
http://mysite.com/page/2