Kohana V3 中用于多个应用程序的 .htaccess
您好,我在 Kohana v3 中设置了多个应用程序,它可以正常工作,无需启用 .htaccess (以删除 index.php 或 admin.php),
我的设置
+ system/ + modules/ + applications/ + public/ + bootstrap.php + ... + admin/ + bootstrap.php + ... + index.php (for 'public' application) + admin.php (for 'admin' application)
是这样访问前端示例 url:
http://mydomain.com/index.php/(controller_name)/...
并访问管理站点;
http://mydomain.com/admin.php/(controller_name)/...
任务是,我想使用.htaccess(mod_rewrite)删除并用/admin/替换index.php(默认url)和admin.php,这样它就可以是
http://mydomain.com/(controller_name) <- 'public' application http://mydomain.com/admin/(controller_name) <- 'admin' application
我当前的.htaccess(不工作);
# Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase /ko3/ # Protect hidden files from being viewed Order Deny,Allow Deny From All # Protect application and system files from being viewed RewriteRule ^(?:web-apps|modules|core)\b.* index.php/$0 [L] # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # TODO: rewrite admin URL to admin.php/URL #RewriteRule ^admin/(.*) admin.php/$0 [L] # Rewrite all other URLs to index.php/URL RewriteRule .* index.php/$0 [PT]
Hi I have setup multiple application in Kohana v3, it works normally without enabling .htaccess (to remove index.php or admin.php)
my setup
+ system/ + modules/ + applications/ + public/ + bootstrap.php + ... + admin/ + bootstrap.php + ... + index.php (for 'public' application) + admin.php (for 'admin' application)
so to access the frontend sample url will be;
http://mydomain.com/index.php/(controller_name)/...
and to access administration site;
http://mydomain.com/admin.php/(controller_name)/...
The task is, I want to remove and replace index.php (default url) and admin.php with /admin/ using .htaccess (mod_rewrite) so it can be
http://mydomain.com/(controller_name) <- 'public' application http://mydomain.com/admin/(controller_name) <- 'admin' application
my current .htaccess (not working) is;
# Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase /ko3/ # Protect hidden files from being viewed Order Deny,Allow Deny From All # Protect application and system files from being viewed RewriteRule ^(?:web-apps|modules|core)\b.* index.php/$0 [L] # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # TODO: rewrite admin URL to admin.php/URL #RewriteRule ^admin/(.*) admin.php/$0 [L] # Rewrite all other URLs to index.php/URL RewriteRule .* index.php/$0 [PT]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常 RewriteBase 参数是 '/' 而不是 '/ko3/' - 它是您的 webroot 中的文件夹名称。另请检查网络服务器的配置是否支持 modrewrite。
Usually RewriteBase param is '/' instead of '/ko3/' - its a folder name in your webroot. Also check webserver's configuration for modrewrite support.