我在我的public_html文件夹的根目录下安装了一个html / shtml网站,并在" ci_code"中安装了CodeIgniter。子文件夹和两个.htaccess文件:一个在根文件夹中,一个是" ci_code"文件夹中。
要访问CodeIgniter,网站,我使用以下网址:
example.com/ci/{params}
我想用这样的国际化网址屏蔽CodeIgniter文件夹名称
example.com/ci_spanish/{params}
example.com/ci_english/{params}
我该怎么做?
Root(/).htaccess文件
RewriteBase /
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options +Indexes +Includes
CodeIgniter .htaccess文件
RewriteBase /ci/
RewriteCond %{REQUEST_URI} .*/application/views/.*
RewriteRule ^(.*)$ $0 [L]
RewriteCond %{REQUEST_URI} .*/application/modules/.*
RewriteRule ^(.*)$ $0 [L]
RewriteCond %{REQUEST_URI} /system/.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_URI} /application/.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
答案 0 :(得分:0)
RewriteRule ^ci(.*)/(.*) /ci/$2
会转换
这样的网址http://example.com/ci_engish/test
到
http://example.com/ci/test
但是,我无法告诉CI您要使用哪种语言。您也可以执行类似
的操作RewriteRule ^ci_(.*)/(.*) /ci/$1/$2
将转换像
这样的网址http://example.com/ci_engish/test
到
http://example.com/ci/english/test
您可以使用路由或其他机制来处理该语言。
http://htaccess.madewithlove.be/和http://martinmelin.se/rewrite-rule-tester/是测试.htaccess
内容的不错的小工具