我想将“ 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 放在哪里的位置,我的网站一直给出“页面缺失”。
我的 RewriteRule 好吗?我在哪里插入它?