简体   繁体   中英

How to remove folder name with htaccess in CodeIgniter

So, I already put my website in hosting web server. I have one problem right now.

for example I have this URL for my site :

http://www.example.com/norwin/beranda

I want to remove or delete the folder name 'norwin' from the URL

I am placing my htaccess file in public_html/norwin/.htaccess

this is my .htaccess code :

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]

this rules is not working.

You could try changing your routes.php

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

To

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

User Guide URI Routing http://www.codeigniter.com/userguide2/general/routing.html

My 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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM