「 http://www.example.com/abc」を「http://www.example.com/test/abc 」にマッピングして、最短ルートを実現したいと思います。ユーザーとコンテンツに PyroCMS を使用しています。
デフォルトの pyrocms ファイル:
# Multiple Environment config
# Set this to development, staging or production
# SetEnv PYRO_ENV production
<IfModule mod_rewrite.c>
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
# disable the Apache MultiViews directive if it is enabled on the server. It plays havoc with URL rewriting
Options -MultiViews
RewriteEngine on
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/.*/(vendor|composer\.json|composer\.lock|system/cms/cache|system/codeigniter|system/cms/config|system/cms/logs|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>
このルールをファイルに追加したいと思います。
RewriteRule ^([a-z0-9_]+)$ test/$1
BASE_URL/abc
" " を " " にBASE_URL/test/abc
書き換えるには
でも、
この RewriteRule を配置する場所について多くのポジションを試しましたが、私の Web サイトで「ページが見つかりません」というメッセージが表示され続けます。
私の RewriteRule は大丈夫ですか? そして、どこに挿入しますか?