Php 如何在CodeIgniter中使用htaccess删除文件夹名称

Php 如何在CodeIgniter中使用htaccess删除文件夹名称,php,.htaccess,codeigniter,mod-rewrite,Php,.htaccess,Codeigniter,Mod Rewrite,所以,我已经把我的网站放在托管服务器上了。 我现在有一个问题 例如,我的网站有以下URL: http://www.example.com/norwin/beranda 我想从URL中删除文件夹名'norwin' 我正在将我的htaccess文件放入public\u html/norwin/.htaccess 这是我的.htaccess代码: RewriteEngine on RewriteCond $1 !^(index\.php|images|stylesheets|system/

所以,我已经把我的网站放在托管服务器上了。 我现在有一个问题

例如,我的网站有以下URL:

http://www.example.com/norwin/beranda
我想从URL中删除文件夹名
'norwin'

我正在将我的htaccess文件放入
public\u html/norwin/.htaccess

这是我的
.htaccess
代码:

RewriteEngine on

    RewriteCond $1 !^(index\.php|images|stylesheets|system/application/sources/)

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ ./index.php/norwin/$1 [NC,L]

此规则无效。

您可以尝试更改路由。php

$route['controller/function'] = "controller/function";

用户指南URI路由

我的Htaccess

Options +FollowSymLinks
Options -Indexes

<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
    Order deny,allow
    Deny from all
</FilesMatch>

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Options+FollowSymLinks
选项-索引
命令拒绝,允许
全盘否定
DirectoryIndex.php
重新启动发动机
1美元^(索引\.php | images | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L,QSA]

我已经试过了。。我的控制器名为“beranda”,但为什么不起作用?我添加了我的htacess,但不知道您使用的是哪种类型的操作系统或本地主机?我应该在.htaccess文件中覆盖该规则吗?我使用的是apache和Windows这里有更多的Htaces for codeigniter,请找到最适合您的操作系统和服务器的,并将其添加到主目录。
Options +FollowSymLinks
Options -Indexes

<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
    Order deny,allow
    Deny from all
</FilesMatch>

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]